gotcha

Author Topic: Exporting PNG from SVG - all black image?  (Read 11263 times)

February 01, 2018, 09:16:08 AM
Read 11263 times

evergreen

  • Sr. Newbie

  • Offline
  • **

  • 4
Hi All-

Trying to export a svg to png at multiple DPI, 384/192/96 and after the export, at the higher DPI 384,192 the image exported doesn't seem viewable. On my desktop, the image preview looks like an all black graphic. At DPI 96 it seems to look fine on my machine.

Opening in the default editor on my machine (windows photo viewer) it just shows up as all black, and attempting to open it up in GIMP, my memory spikes up 10GB, and it basically hangs my computer attempting to open the image. The image file itself is 5MB in size.

Page size is 101760 x 13440 (at 384DPI)

Unsure what is happening, could it just be that I'm using the wrong editor to view the exported png files? A setting that I can change? Can I remove transparency?

Appreciate any advice,
-a
  • .92
  • Windows7

February 01, 2018, 10:04:18 AM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

In Inkscape, when you change the DPI, it changes the size of the export.  So at the higher DPIs, the images have simply become so huge that they challenge your resource.

Hhm, so you're on Windows 7.....I haven't heard this complaint for 7.  (On Windows 10, the photo viewer background is black by default.  So if you have a black line drawing, you can't see it.  One of the many reasons I reverted back to 7.)

We have seen complaints about various viewers not being able to handle transparency properly.  Windows Explorer included.  Often filters are involved when we see either all black PNGs, or just black background.  But I haven't heard of the Windows Photo Viewer behaving like that.  If the transparency can be removed, that would be a good thing to try.

Can you share one of the problematic images?  I'm pretty sure you won't be able to attach that large of an image here.  But you could try something like dropbox, and then just give us the link to it.

The only other thing that comes to mind, is maybe you didn't use the right option in the Export PNG dialog, and it didn't export the correct portion of the canvas.  But that would only be a reasonable explanation if either there is a black area on the canvas which you mistakenly exported, or you exported nothing - just an empty area of the canvas (which would be transparent, if you didn't change it on purpose).
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

February 01, 2018, 10:47:50 AM
Reply #2

evergreen

  • Sr. Newbie

  • Offline
  • **

  • 4
Thanks for the welcome!

Unfortunately I can't share the problematic image (boo) I will try to figure some way to create some data that I can share.

I did retry the export- just to double check the options, and exported at at 384 and 96 DPI in the same session and seemed to have the same result. (Settings were Export area: Page, and everything else was untouched...opacity at 100%)

Tried to remove the transparency by the following:
1. Ctrl-Shift-D (bring up the document properties)
2. Click on Background color to bring up color picker.
3. Change the alpha to 255
4. Rexport image at 384/96

Tried to open both in the photo viewer, and the 384 dpi is now an all white graphic still blank in the photo viewer... (96 looks fine)

As another test, I did try to export a section of the svg at 384, and small sections seem to export fine...

Wondering if the exports are fine, but my viewing tool(s) are the issue.
  • .92
  • Windows7

February 01, 2018, 11:22:09 AM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
It's hard to say without an example to test with.  Could you create just an example SVG file which shows the problem?  It only needs to show the basic type of contents, even if objects are just circles or something easy to draw.

Since recent versions of Inkscape, you can't just select all and look at opacity.  Many versions back, the alpha or opacity of a Group showed that there was some transparency in the group.  Now, it shows 100% opacity, even if there are objects in the group which are transparent  :(

The color/alpha/opacity settings in Document Properties only affect the background.  It doesn't change anything else.

When you export using Page option, you're sure the image is within the page borders, right?  Curious that a small section of the image exports properly....

What if you try selecting the whole page, and use the Selection option?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

February 01, 2018, 01:47:36 PM
Reply #4

evergreen

  • Sr. Newbie

  • Offline
  • **

  • 4
Hi again-

Doing some more experiments- stripped out everything aside from a triangle in my svg, which I then scaled for better visibility, and still getting the same behavior. Here's the raw svg.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dsy="http://www.3ds.com/print"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   style="background : rgb(255,255,255)"
   width="6731mm"
   height="889mm"
   version="1.1"
   viewBox="0 0 6731 889"
   dsy:text-version="21000"
   id="svg88844"
   sodipodi:docname="ImageTestPlainSVG.svg"
   inkscape:export-filename="C:\tmp\384_test.png"
   inkscape:export-xdpi="384"
   inkscape:export-ydpi="384"
   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
  <metadata
     id="metadata88850">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs
     id="defs88848" />
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="1"
     inkscape:pageshadow="2"
     inkscape:window-width="2587"
     inkscape:window-height="1570"
     id="namedview88846"
     showgrid="false"
     inkscape:zoom="0.05053066"
     inkscape:cx="12128.91"
     inkscape:cy="4476.773"
     inkscape:window-x="485"
     inkscape:window-y="209"
     inkscape:window-maximized="0"
     inkscape:current-layer="svg88844" />
  <path
     id="path73080"
     d="m 5518.18,241.225 -100.35,-200.065 -100.34,200.065 z"
     inkscape:connector-curvature="0"
     style="fill:#000000;fill-rule:evenodd;stroke:none;stroke-width:0.13;stroke-linecap:butt;stroke-linejoin:miter" />
</svg>
  • .92
  • Windows7

February 01, 2018, 07:31:26 PM
Reply #5

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Unfortunately, I can't understand the raw SVG.  I managed to get it open in Inkscape though.

The first thing I see is that you probably have the wrong Scale setting in Document Properties > Page tab.  For px units, the Scale should be set at 1.0 (unless you have some unusual reason for using something different).  Although that probably doesn't have anything to do with the black display. 

It could be part of the problem with the large DPI being so large to challenge your system resources, though.  Because the page is nearly 2 feet wide at 96 dpi.  When I changed the dpi to 384, it took 5 minutes to export the page.  It turns out to be ....I must have miscalculated something....88 feet wide?  Nearly 30 yards?

In any case, I have your same experience.  At 96 dpi, no problems.  At 384, the whole thing is black.  It doesn't even show the triangle! (which I changed from black to purple, so I could see it)  I have to think it has something to do with either the dpi or the huge size. 

I wonder what would happen....well, I'm not even sure it's possible, but I guess it could be open with Adobe Reader??  Hhm - error message - either unspported file type, or corrupted file.  Oh well, just a thought.

Well anyway, this has moved beyond my skill set, to be able to figure out what's wrong.  The SVG file looks perfectly fine, and the only remarkable factor is the huge size.  Maybe someone else can find a clue?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

February 02, 2018, 04:54:05 AM
Reply #6

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Wanted to answer yesterday, but when I clicked on Post, the forum went down...

Uhm, well - more than 100 000 px width? While the file format can hold
that size, Gimp starts swapping when trying to display the image on my
machine with 16 GB RAM, and Firefox just shows the correct shape, but no
contents - I don't think it even tries to display the contents, but who
knows...

My suggestion: either export in a smaller size or tile the image.
What do you need that size for?

February 02, 2018, 09:06:42 PM
Reply #7

evergreen

  • Sr. Newbie

  • Offline
  • **

  • 4
Thanks all for the input.

Not sure how the dimensions translates...

When the forum went down, I had a small panic, was wondering if the SVG that I pasted caused the issue. Thought I'd be banned :)

Was planning to actually tile these PNG exports! So don't really need the full image in one file.

Current pipeline is:
1. Inkscape: Export the image at each DPI
2. ImageMagick: Pad to the right and bottom of image to a factor or 256px
3. ImageMagick: Tile the image into 256x256 tiles

I do this in a batch script, so I'm using the command line interface. Is there a way to achieve a tiled version of this drawing at these higher resolutions?

Do you all think that perhaps the exported image is actually ok, if one had a super computer, it might be viewable?

Appreciate all your time-


  • .92
  • Windows7

February 03, 2018, 05:35:17 AM
Reply #8

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
> Do you all think that perhaps the exported image is actually ok, if one had a super computer, it might be viewable?

Lol, I don't know - wish I had one for testing ;-)

Inkscape has a command line option for indicating the export area and the dpi (-a and -d, see https://inkscape.org/en/doc/inkscape-man.html). So you could automate setting the area and the dpi value and get your tiles right out of Inkscape. No need for im/mogrify (unless you're also changing the file format).

February 03, 2018, 05:36:01 AM
Reply #9

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Oh, and better use the interactive mode, don't restart Inkscape for each tile.

February 03, 2018, 12:17:00 PM
Reply #10

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
the forum went down...
When the forum went down,

While I was doing some work on the forum at the time, that particular issue seems to have been just a random glitch with a database.  Fortunately, I was online when it happened, and got it fixed relatively quickly.  I apologize for the inconvenience.

I haven't seen or heard of uploading a huge image to corrupt a database.  And I've specifically configured the forum and server to be able to display a....I forget what it's called now - full frame?  what they used to call a 35 mm photo.  I just never expected anyone would need more than that.

Normally what will happen if the image you attach is too large, the message just won't post at all.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

April 06, 2018, 04:10:41 AM
Reply #11

Gary68

  • Jr. Member

  • Offline
  • ***

  • 15
Hi,

Quote (selected)
Was planning to actually tile these PNG exports! So don't really need the full image in one file.

I'm trying to do pretty much exactly the same thing, even down to the imageMagick part (which is another problem in itself).

I have 128GB of memory and I still get the black\empty images when exporting at resolutions >  65536 x 65536.
  • 0.92
  • Windows 10

April 07, 2018, 08:45:32 AM
Reply #12

Gary68

  • Jr. Member

  • Offline
  • ***

  • 15
Quote (selected)
Inkscape has a command line option for indicating the export area

Yep that works quite well  :tup:

Quote (selected)
Oh, and better use the interactive mode, don't restart Inkscape for each tile.

Does interactive mode allow for some form of scripting \ batch processing? As in my case I'm dealing with hundreds if not thousands of images.
  • 0.92
  • Windows 10

April 07, 2018, 12:13:17 PM
Reply #13

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Yes, you can batch process in interactive mode, too. It's just that Inkscape doesn't restart between the different commands, that's what takes long.

April 07, 2018, 02:35:38 PM
Reply #14

Gary68

  • Jr. Member

  • Offline
  • ***

  • 15
I can't find any documentation on the --shell command other than the one line on the main page, and that is throwing errors for me:

Quote (selected)
>test.svg --export-png=test.png -w256 -h256
Background RRGGBBAA: ffffff00
Area 0:0:193512:193512 exported to 256 x 256 pixels (0.127 dpi)
Bitmap saved as: test.png

** (inkscape.exe:19420): WARNING **: Can't open file: FilesInkscapeinkscape (doesn't exist)

** (inkscape.exe:19420): WARNING **: Can't open file: FilesInkscapeinkscape (doesn't exist)

** (inkscape.exe:19420): WARNING **: Specified document FilesInkscapeinkscape cannot be opened (does not exist or not a valid SVG file)

It also looks like it doesn't support outputting to a sub folders, for example:

Quote (selected)
test.svg --export-png=\output\test.png -w256 -h256

Produces a file called outputtest.png :(

I haven't even got to executing multiple exports yet due to all the errors. But with no documentation I can only guess at how its supposed to be used.

Sorry for taking this off topic.

Edit:

1) Error was down to not having the global path setup in my environment variables
2) output path was down to using \ instead of /

Although exporting an area in Interactive mode is no quicker that using the command line. And considerable slower than just doing the same export from the GUI :(

Edit:

Created a dedicate post for Interactive here https://forum.inkscapecommunity.com/index.php?topic=1071.0
« Last Edit: April 09, 2018, 07:35:27 AM by Gary68 »
  • 0.92
  • Windows 10

April 08, 2018, 05:22:06 AM
Reply #15

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Interesting, it shouldn't be slower...

July 08, 2018, 04:48:35 PM
Reply #16

pcardout

  • Newbie

  • Offline
  • *

  • 1
If your image is a black drawing on a white background you can get fooled!

Even though it didn't work for the OP, this was the solution for me


Tried to remove the transparency by the following:
1. Ctrl-Shift-D (bring up the document properties)
2. Click on Background color to bring up color picker.
3. Change the alpha to 255

My problem was not that my image was too big.  It was a black line drawing.  By having a transparent background, when I viewed it with "feh" (one of many linux image viewers) I saw
black lines against a black background ... so "all black".   This happened even though the background on screen was white.  Removing the background transparency, I saw
my black lines on a white page ... as expected.  This was a funny "gotcha".  This happened on a fresh install of Inkscape, on my first drawing. 
  • Inkscape 0.91 r13725
  • [Linux Mint 18.3 _Sylvia]/ xenial also Debian jessie

July 08, 2018, 05:28:18 PM
Reply #17

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Same with Windows 10's native image viewer!
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

July 09, 2018, 04:00:08 AM
Reply #18

shawnhcorey

  • Sr. Newbie

  • Offline
  • **

  • 5
Code: [Select]
width="6731mm"
height="889mm"

67m ≅ 22ft
9m ≅ 3ft

I think that is beyond most software.
  • 0.91
  • Lint Mint 17.3
Don't stop where the ink does.