Inkscape.org
Beyond the Basics Abysmal performance trying to export PNG image
  1. #1
    emu34b emu34b @emu34b

    Hello, long time user here, I wasn't sure to file this under a bug report, since I'm not really sure if this could be classified as a bug.

    Put it simply, Inkscape has a ton of trouble exporting this image. I'm trying to export it at 3400x4400, however the details don't really matter. Trying to export it at a much smaller size, disabling background and foreground elements, splitting it into pieces, it always produces the same result: Inkscape will hang, and render it extremely slowly for hours, provided I don't stop it. I've tried this on multiple computers (running Windows), and the result is the same. I've tried it in 1.0b2, and 0.92.4, and the behavior is still the same.

    Now, I've had problem vectors before, but never to this degree. This is ridiculous. This is where the "I'm not sure if this a bug" part comes in. I'm wondering if there's anything I can do at all to speed up this process, preferably without removing layers. Linked below is the SVG. Simply try to export it as a page and you will be able to reproduce it.

    https://cdn.discordapp.com/attachments/438510426989264917/696601346283012136/efp1.svg

  2. #2
    grepper grepper @grepper
    *

    What do you mean exporting as a page?  What format are you trying to export (save as) to?  Sorry if that is a stupid question.

    Is it ok to remove extra stuff like shown below?

    Clicking through the elements in the tree, there seems to be a lot of extraneous groups, etc.  Okay to simplify the tree by deleting apparently not necessary groupings?

  3. #3
    emu34b emu34b @emu34b

    I'm trying to export to a PNG image. T

    o answer your questions, the extraneous lines are there for a reason, that is to help things that are blurred in multiply layers to not clip. You'll see if you delete them.

    Also, go ahead and try to delete some of the groupings. Keep in mind however, if the group shows clipped at the bottom, its there for a reason. Just be careful.

  4. #4
    jonpatterns jonpatterns @jonpatterns

    Did you get a result at the end of the long wait, or did you terminate Inkscape before the export had finished?

    What happens if you export page at quarter and half resolutions? Do you get on output or do you have to terminate Inkscape?

    I'm testing now on Linux.

  5. #5
    jonpatterns jonpatterns @jonpatterns

    Okay after an hour I terminated Inkscape. PNG file is 0 bytes. I think this is a bug. No way it should take so long - if you think about it the program has to rasterize the image to display it in the main window.

    My guess is some part or aspect of the drawing is making the program fall over when export is called.

    I notice your drawing has a lot of layers, could be connected.

    You could try export elements individually to see if a specific part causes the hang.

    No error is output in the Linux terminal.

    - - -

    A work around is it take several screenshot and sew them together.

  6. #6
    grepper grepper @grepper

    On an old under powered Windows 7 laptop I just SAVE AS>PNG at original size.  Took it about 3-4 seconds.  Worked fine.

    Tried FILE>EXPORT PNG and it seems to hang Inkscape or at least it's going to take all day.  It opens the Export dialog, but does not even show the progress bar.

    What's the difference between SAVE AS and EXPORT PNG?

    So, FWIW, it happens to me too.

     

  7. #7
    jonpatterns jonpatterns @jonpatterns

    I can 'save as PNG' as well, but for me it removed some of the shading effects. Also, I can't see how to set the size of output etc on 'save as PNG'.

    Efp1
  8. #8
    Flamingolady Flamingolady @flamingolady🦩

    Do you get a better result using save as a bitmap?  

  9. #9
    jonpatterns jonpatterns @jonpatterns
    *

    I tried saving as PDF with 383 dpi resolution, but Inkscape froze again.

    Inkscape uses ImageMagick to output PNG as stated in this thread

    https://inkscape.org/forums/questions/cant-save-blurred-image-to-pdf-or-png/

    I wonder if it as having a hard time dealing with so many layers?

  10. #10
    jonpatterns jonpatterns @jonpatterns

    I could open the .svg file in GIMP (3440 px wide) and export as PNG (though both operations took a few minutes). Unfortunately, it interpreted the sun in the top right a little incorrectly. Firefox opens the image correctly.

  11. #11
    emu34b emu34b @emu34b
    *

    If GIMP works that's good. The sun I've exported as a separate file no problem, in my efforts to optimize the process. I will attempt using GIMP for my export, possibly from now on. I'll report results in a bit.

    Since Inkscape apparently uses ImageMagick as the export backend, would this be a bug with that and not with Inkscape itself?

  12. #12
    emu34b emu34b @emu34b
    *

    To report back, GIMP 2.10 does not open the image correctly. It doesn't seem to be able to correctly interpret the shading on the face (image attached) Clouds are also wrong. Back to square 1 I suppose...

    Right now I'm rendering it on my server. Its been at it for almost 21 hours now, rendering only the character and not the sun (foreground) or background. It was split roughly into 2 images, and given basically a Xeon E5 2660 each to render it on, its rendered roughly a third of each. So it does appear to be rendering, but extremely slowly.

     

    Capture
  13. #13
    Aero Aero @Aero◻️
    *

    I could export to PNG at 3400x4400 in less than a minute after setting blend mode for all layers to normal. Seems this is the source to the performance issues in your file. 

  14. #14
    emu34b emu34b @emu34b

    The blend modes are there for a reason, mostly to give definition and depth to the character.

  15. #15
    jonpatterns jonpatterns @jonpatterns

    It looks like the is a bug with blend modes. I don't think it's processing them just hanging.

    I tried Inkscape and ImageMagick (convert) via command line and they just sat there for a hour until I terminated them, no error was reported.

    inkscape -z -w 3440 -h 4400 efp1.svg -e output.png

    convert -size 3440x4440 efp1.svg convert-test.png

    I tried svgexport from this thread https://stackoverflow.com/questions/9853325/how-to-convert-a-svg-to-a-png-with-imagemagick

    It has a similar output as Gimp - not showing the blends.

    Svg Export Comp
  16. #16
    jonpatterns jonpatterns @jonpatterns
    *

    It seems that the layer blend mode 'multiply' is the cause of the bottle neck. Exporting with 'normal' and 'screen' layers is quick.

    I've developed a test using a file with 30 multiply layers from your file (attached). It is in Linux bash

    uptime && inkscape --export-png=efp1-30m-dpi.png --export-area-page --export-dpi=30 efp1-multiply-30.svg && uptime

    The dpi can be specified, it prints the uptime before and after conversion.

    90 x 116 pixels (10 dpi) - took about 4 minutes

    270 x 349 pixels (30 dpi) - took about 6 minutes

    540 x 699 pixels (60 dpi) - took about 42 minutes!

    810 x 1048 pixels (90 dpi) - took about 50 minutes?!

     

    I hope it's cool using the modified version of your file for test purposes?

     

    Efp1 Multiply 30
  17. #17
    emu34b emu34b @emu34b

    I dont mind you modifying the vector. Do keep in mind that multiply is part of the shading, however.

    Also, the attachment isn't loading.

  18. #18
    jonpatterns jonpatterns @jonpatterns
    *

    The attachment has thirty layers set as 'multiply'. The file probably appears blank because your browser doesn't process multiply layers (it's like that for me on Firefox). If you open the original file in the browser the shading is wrong for this reason.

    GIMP almost gets the shading right. I tried various online convertors but none of them render image correctly.

     

    Ep Firefox Gimp Inkscape
  19. #19
    emu34b emu34b @emu34b

    Yeah. I think this may be a bug report for ImageMagick, then. I really can't see why it would have such a tough time with multiply either. I can't just not use it, but for solid colors it may be possible to precalculate colors. Its still going 3 days later on the server, rendering about 2.28 MB of the file now. I'm keeping it going as a curiosity at this point.

    Is it possible to use Inkscape's own renderer to do this? Inkscape still has problems, but it's obviously able to render it much faster. I've attempted screenshotting in parts, but its very difficult to align.

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Abysmal performance trying to export PNG image