Systems and methods for compressing vector graphics
Abstract
Described herein is a computer implemented method for compressing a shape. The method includes: receiving input shape data defining first and second original shape commands and generating first and second compressed shape commands corresponding thereto. Generating the second compressed shape command includes generating a relative shape command that is a version of the second original shape command in which parameters are relatively defined; generating an absolute shape command that is a version of the second original shape command in which parameters are absolutely defined; and selecting a smaller or equal smallest of the relative shape command and the absolute shape command to be the second compressed shape command.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 3 · Forward citations: 0.
Claims (8)
- Claim 1Independent Claim
A computer implemented method for compressing a shape, the method including: receiving input shape data defining one or more shape commands in respect of the shape; initialising a compressed shape variable for storing data that defines a compressed version of the shape; processing a first shape command of the one or more shape commands by: determining a type of the first shape command; in response to determining the type of the first shape command is a line type shape command: determining if the first shape command defines a negligible line, based on a proximity of an end point of a first line defined by the first shape command to a start point of the first line being less than a proximity threshold; and in response to determining that the first shape command does define a negligible line, not adding data from the first shape command to the compressed shape variable; or in response to determining that the first shape command does not define a negligible line, recording the first shape
- Claim 2Depends on #1
The computer implemented method of claim 1, wherein the end point of the first line is defined by the first shape command.
- Claim 3Depends on #1
The computer implemented method of claim 1, wherein the start point of the first line is defined by a previously recorded shape command.
- Claim 4Depends on #1
The computer implemented method of claim 1, wherein determining that the first shape command defines a negligible line includes: calculating a horizontal distance between an x coordinate of the end point of the first line and an x coordinate of the start point of the first line; calculating a vertical distance between a y coordinate of the end point of the first line and a y coordinate of the start point of the first line; and if the horizontal distance is greater than or equal to a horizontal proximity threshold or the vertical distance is greater than or equal to a vertical proximity threshold, determining that the shape command does not define a negligible line.
- Claim 5Depends on #1
The computer implemented method of claim 1, wherein recording the first shape command includes adding the first shape command to the compressed shape variable.
- Claim 6Depends on #1
The computer implemented method of claim 1, wherein: determining that the first shape command is a line type shape command includes determining that the first shape command is a straight line type shape command; and recording the first shape command includes: writing data from the first shape command to an open line; and adding the open line to the compressed shape variable.
- Claim 7Depends on #6
The computer implemented method of claim 6, wherein prior to adding the open line to the compressed shape variable, the method further includes processing a second shape command of the one or more shape commands by: determining if the second shape command is a straight line type shape command; in response to determining that the second shape command is a straight line type shape command, determining whether a first angle defined by the first shape command is within an angular threshold of a second angle defined by the second shape command; and in response to determining that the first angle is the same as the second angle, updating the open line to define a line having an end point that is an end point defined by the second shape command.
- Claim 8Depends on #1
The computer implemented method of claim 1, wherein: determining that the first shape command is a line type shape command includes determining that the first shape command is a straight line type shape command; and in response to determining that the first shape command does not define a negligible line, the method further includes: determining whether a previously recorded shape command is a straight line type shape command; in response to determining that the previously recorded shape command is a straight line type shape command, determining whether a first angle defined by the first shape command is within an angular threshold of a second angle defined by the previously recorded shape command; and in response to determining that the first angle is the same as the second angle, recording the first shape command by updating the previously recorded shape command to define a line having an end point that is an end point defined by the first shape command.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATION This application is a U.S. Continuation Application of U.S. Non-Provisional application Ser. No. 18/211,239, filed on Jun. 17, 2023, that claims priority to Australian Patent Application No. 2022204492, filed Jun. 24, 2022, which are each hereby incorporated by reference in their entirety. TECHNICAL FIELD Aspects of the present disclosure are directed to systems and methods for compressing vector graphics. BACKGROUND Many computer applications make use of vector graphic format images to store and display digital images. As with all digital images, vector graphics have to be stored in memory. Accordingly, there are significant advantages to be had if a vector graphic can be compressed so that, inter alia, less memory is required to store that vector graphic. SUMMARY Described herein is a computer implemented method for generating a compressed shape, the method including: receiving input shape data defining a plurality of shape commands, the plurality of shape commands including an first original shape command and an second original shape command; generating a first compressed shape command, the first compressed shape command corresponding to the first original shape command; adding the first compressed shape command to the compressed shape; generating a second compressed shape command, the second compressed shape command corresponding to the second original shape command; and adding the second compressed shape command to the compressed shape, wherein generating the second compressed shape command includes: generating a relative version of the second shape command in which one or more parameters defined by the second original shape command are relatively defined; generating an absolute version of the second shape command in which one or more parameters defined by the second original shape command are absolutely defined; and selecting a smaller or equal smallest of the relative version and the absolute version to be the second com
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (3)
| Patent | Title | Year | Citations |
|---|
Non-Patent Literature (10)
- Anton Khlynovskiy,
- ‘
- Of SVG, Minification and Gzip
- ’
- , Nov. 15, 2017, , [retrieved on Jul. 6, 2023].
- Battiato, S., Greco, F.,
- &
- Nicotra, S. (Feb. 2006), Compressed SVG Representation of Raster Images Vectorized by DDT Triangulation. In Eurographics Italian Chapter Conference (pp. 233-239).
- C. Seel-audom, W. Naiyapo and V. Chouvatut,
- “