SVG file sizes #704
KeyWorksRW
started this conversation in
Code Generation
Replies: 0 comments
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
SVG file sizes can be quite large, even for what seems like fairly simple images. If you have a lot of graphics in your program, those sizes can add up to a significant amount.
When you specify a SVG file in wxUiEditor, it will first strip out attributes and XML nodes that aren't used by wxWidgets, as well as removing all unused whitespace. Next it runs it through zlib compression before generating a data array in the first source file that uses the image. The result is fairly close in size to what you would have gotten from a PNG file, but with the advantage of accurately scaling to any size. The size is typically between 5%-20% of the original file.
Note that you don't need to do anything special to display the image in your program. wxUiEditor generates a 5-line function that will decompress the SVG data into a string and calls
wxBitmapBundle::FromSVG()
to convert that into an image.Beta Was this translation helpful? Give feedback.
All reactions