Converting SVG to SVG and replacing viewBox
Hello everyone, What's a proper way to convert an SVG image file and replace its viewBox size, and then save? For example, loading 32x32 svg file, and save it as 16x16. input: http://www.w3.org/2000/svg;> output (using Figma): http://www.w3.org/2000/svg;> My first attempt was to use SVGGraphics2D with loaded svg document and then change svgCanvasSize. However, I got invalid file with missing defs and invalid formatting. Thank you in advance for any help. Konstantin
offset attribute should be set to 0 if it is missing in the stop tag
Hello everyone, Some time ago, I've submitted a PR at https://github.com/apache/xmlgraphics-batik/pull/20 but had no attention since then. Many modern design tools like Figma and others do not put offset attribute when generating an SVG image if offset equals 0. See https://www.w3.org/TR/SVG/pservers.html#GradientStopAttributes Batik fails with exception while trying to read such Ss. Other programs successfully open these files. The pull request sets offset to 0 when the attribute is missing. The patch is available here https://github.com/apache/xmlgraphics-batik/pull/20/commits/20ad4382a0a4613956d1e543002e81b235ad1561 or as a patch file https://github.com/apache/xmlgraphics-batik/pull/20/commits/20ad4382a0a4613956d1e543002e81b235ad1561.patch Please review and merge if possible. With best regards, Konstantin Example of an icon: http://www.w3.org/2000/svg;>