Author Topic: Max Size Export SVG to PNG  (Read 767 times)

November 15, 2018, 02:27:44 AM
Read 767 times

acerola

  • Sr. Newbie

  • Offline
  • **

  • 2
Hello Everyone

I'm new in this forum. I have a Problem exporting a large SVG to PNG.

My SVG Document out from Visio 2016 is: 15000mm x 800mm.  I attached the SVG.
I can open it normally in Inkscape. But when I export it (Using Default 96dpi)  (inkscape.com Graphic.svg --export-png="Graphic.png"  -background=#FFFFFF) there is no error. But opening in any image viewer it shows only an empty black screen image.

I found out that when I resize it down to 8600mm x 800 with (96dpi) = 32504 x 3024 pixels  I works. But higher wont work.  On Google I found some information about any max size of 32767px in Cairo.

Cairo:
src/cairo-image-surface.c
Around line 60 it has:
#define MAX_IMAGE_SIZE 32767

I use InkscapePortable 0.92.3  in CommandLine

Any ideas?  How to Change Cairos Max Size?

Thank you so much!
  • Windows 10

November 16, 2018, 08:20:33 AM
Reply #1

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Ha, that seems to explain some of the questions we had! I didn't know about that max size setting. You'd need to ask cairo developers about that. I'll ping Bryce, maybe he has time to explain.

November 16, 2018, 08:21:50 AM
Reply #2

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln

November 16, 2018, 10:51:12 AM
Reply #3

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Just in case the chat website will be down at some point, here is Bryce's reply:

Quote (selected)
hi Moini
it does look like Cairo will emit an error if the image size is out of bounds, so the lack of an error message may be on the Inkscape side.
it creates an error surface, so inkscape would need to check for that and display an error dialog

bryce 7:34 PM
the reason for the limitation is due to a design limit in Pixman, which has a fixed maximum image size. Looking into the pixman code, there are some hard assumptions in there about the data types which would be extremely non-trivial to change.
(I'm looking at pixman-bits-image.c and create_bits() in particular)
one observation though is that the above is true only for the *image* backend in Cairo. Other backends (like xcb which we use for display on Linux, or win32 on windows) may have different size capabilities, but I'm not certain.
anyway, as to the question of changing cairo's max size, it'd require some programming effort to rework the code to use larger data types in Pixman, and/or to (maybe) use a different Cairo backend in Inkscape when generating PNG's.
a workaround may be to do the export in four separate PNGs via the Inkscape command line, and then combine them as a post-processing step.

So this means:

- it cannot be changed easily
- one would need to do a lot of difficult work in the pixman library to change this
- there is a way to work around this, by exporting smaller areas via command line, then stitching them together
- Inkscape should at least issue an error message (or maybe it could also implement the workaround).

November 16, 2018, 10:52:24 AM
Reply #4

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
For the last thing, you could create a bug report at https://bugs.launchpad.net/inkscape . Note that the bug tracker will move soon (months), and you may be asked to help transfer the info into the new tracker.

November 16, 2018, 12:44:37 PM
Reply #5

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Or maybe, as Bryce suggested later, you know some Python and can draft an extension? 'Export large images' or something?

November 18, 2018, 11:10:50 PM
Reply #6

acerola

  • Sr. Newbie

  • Offline
  • **

  • 2
I found a solution that worked for me. I needed to make a DZI (DeepZoom Image Object) out from the SVG. And normally I used to make it from a PNG.  Now the newest Version of Vips (dzsave)   support SVG too.
Thank you so much for all your help.
  • Windows 10