piqnt / svgexport

SVG to PNG/JPEG command-line tool and Node.js module
930 stars 86 forks source link

Wrong image exporting #99

Open mattsrinc opened 3 years ago

mattsrinc commented 3 years ago

I'm submitting an official bug after days of struggling (believing it was a Leaflet and/or one of caching plugins for it).

Here's the comparison of svgexport output for one part of the larger image:

svgexport-bug-png-generation

You can see the proper output with svgexport 0.3.2 (no Puppeteer library) and missing part with svgexport 0.4 (.0 and .1, with Puppeteer). I'm certain that going Puppeteer is the right way and suspect the bug might be in the resize.js.

The svgexport command to reproduce the above was equivalent to this

svgexport test.svg test.png 1591:2214:1107:1107 256:256 'svg{background:none}'

and actually all exported parts of the image when top position specified in viewBox was higher (number) than above are completely blank with svgexport 0.4.1.

So the issue is related to #98 regarding missing parts of an exported image.

I cannot upload the image for above (client copyright) yet am attaching a sample image with same viewBox to test. You can uncomment javascript part in the file to generate other patterns (but do have fixed image to test :-) ). checkboard-fixed.svg.zip

mattsrinc commented 3 years ago

Here's one bigger map, tiles exported with svgexport 0.4.1 (version 0.3.2 just freezes on the first image, SVG viewbox is "0 0 4688 7015".

Screenshot_2021-04-15 Leaflet properties map

So image tiles are just not generated with svgexport, and command line is the same with proper parameter

SVGEXPORT_TIMEOUT=90

(at this SVG resolution on older MacBook Pro each image export takes max. 75 s).

Would really like to get any help on this one.

kryztoval commented 3 years ago

I don't know if this is related, but I was trying to export the Ghostscript_Tiger.svg in high resolution (anything above 11x) and the image gets cut off. If I go 20x it would say "Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot"

My computer has 51GB of free ram, running svgexport as admin or user changed nothing.

As this user suggested, using version 0.3.2 works flawlessly exporting the Ghostscript_Tiver.svg at 20x