PNG export broken when area includes images with masks?

This is NOT a support forum. You are welcome to discuss software issues here, but all issues should be reported on Launchpad if you want them fixed.
Pond

PNG export broken when area includes images with masks?

Postby Pond » Wed Aug 20, 2008 6:36 pm

Suppose I create a completely white image using the GIMP. I add an alpha channel so that the image is translucent (nothing fancy, just a flat mask applied as an alpha channel, at say, roughly 2/3 opaque, 1/3 transparent). I save this as a PNG. I thus have a white, translucent image which if plotted on a white background is invisible or if plotted on a black background appears as a light grey rectangle.

Now I create a new Inkscape document. I drag the white, translucent PNG image into the document. I select it and export the selection as a PNG. The exported image is not white! In fact, it's a medium grey. If I drag this exported image back into the Inkscape document and export it again, it's even darker. This process can be repeated until the image is almost black.

Worse, suppose I take the white image and duplicate it. I drag it so that it slightly overlaps the first translucent white image. Within Inkscape, the two objects are rendered as essentially invisible - white things overlapping on a transparent (white) page background. If I now select both overlapping images and export the selection as a bitmap, I get a darker grey image, with a lighter grey area where the two original images overlap. I don't get anything approaching white and the exported bitmap certainly doesn't look even remotely like the rendering Inkscape shows on screen.

I see the same behaviour with 0.45 and 0.46.2, Win32 XP SP3 or OS X 10.5.4 under X11 (xquartz 2.3.1 RC1). I've tried it with and without a colour management profile applied via the display settings under Win32 and it made no difference.

The behaviour was first noticed with a more complex set of PNG images, leading to the simple translucent white image test case described above. Curiously, I have other examples that involve translucent images which don't show the drop in brightness, so there is presumably "something" about some of the images which make Inkscape act strangely.

This seems to be very broken yet I can't find anything via Google to suggest anyone else has noticed. Am I missing some obvious setting somewhere to stop Inkscape acting this way, or is this just a bug?

TIA...

Pond

Re: PNG export broken when area includes images with masks?

Postby Pond » Wed Aug 20, 2008 6:56 pm

Pond wrote:Curiously, I have other examples that involve translucent images which don't show the drop in brightness, so there is presumably "something" about some of the images which make Inkscape act strangely.

Sorry to follow up my own post, but I checked more closely and in fact it seems that any PNG with an alpha channel exports incorrectly. It looks as if the alpha channel is being considered as a scale of grey and accidentally composited in as part of the image's opaque pixel colours as well as being correctly applied as a mask. Very strange.

The other images with which I had tested this only had very slight transparency (alpha channel would be rendered as almost-white), which translates to only a very slight drop in brightness noticed in the exported output. They also had colours which made the change less obvious. Loading the original and exported versions into the GIMP and checking the colours with the colour sampling tool gives the game away, though.

Pond

PNG export broken when area includes images with masks?

Postby Pond » Wed Aug 20, 2008 8:47 pm

I started off thinking this was a usability issue, so posted it to the "Help with using Inkscape" forum, but I'm now fairly sure it's a bug, hence replication here:

http://www.inkscapeforum.com/viewtopic.php?f=5&t=1426


Further to the above, a Win32 nightly build from 15-Aug still shows the problem and it seems likely that any bitmap with an alpha layer causes trouble; I exported the test image as a TIFF and Inkscape was still unable to export the containing document correctly. For now, I'm going to have to remove the bitmap portions of the Inkscape document, export the line art without them then rebuild everything in the GIMP.
Last edited by microUgly on Fri Aug 22, 2008 9:31 am, edited 1 time in total.
Reason: Topics merged.

User avatar
EarlyBlake
Posts: 302
Joined: Tue Jun 03, 2008 5:42 pm

Re: PNG export broken when area includes images with masks?

Postby EarlyBlake » Thu Aug 21, 2008 5:02 pm

I was wondering about this but I had not gotten around to posting a question on it. I ran across it in an odd way. I noticed it when viewing http://fc07.deviantart.com/fs32/f/2008/ ... yBlake.jpg at the limit of my laptop's LCD viewing angle. At that angle most of the image starts to turn gray, except for 2 of the areas. Two area that were white and transparent paths on a white background highlights show up --one near the end of the noise and one on the lower lip. (They are white highlights that I did end up using.) There is another hight light that does not show up. I checked in the inkscape file and it's still there. The ones that show were 30% opacity. The one that doesn't was at 33% opacity. :shock:

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: PNG export broken when area includes images with masks?

Postby microUgly » Fri Aug 22, 2008 9:45 am

Confirmed. Here's an example:

This is the original object exported as PNG (a semi-transparent white and red square)
Image

This is the same file with the previous PNG imported back into the same file then exported to PNG again
Image
The PNG looks ok in Inkscape, but turns grey wheny you export it

Note that the transparency of the PNG is preserved.

This does seem like a bug and I don't see a report on Launchpad. Would you like to log a bug report for it?

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: PNG export broken when area includes images with masks?

Postby sas » Fri Aug 22, 2008 9:27 pm

Pond wrote:For now, I'm going to have to remove the bitmap portions of the Inkscape document, export the line art without them then rebuild everything in the GIMP.

A simpler approach may be to keep the Inkscape document as it is, but export it to PNG using Batik rather than Inkscape.

Pond

Re: PNG export broken when area includes images with masks?

Postby Pond » Sat Aug 23, 2008 12:04 am

microUgly wrote:Confirmed (...) This does seem like a bug and I don't see a report on Launchpad. Would you like to log a bug report for it?

Thanks for the confirmation and example images; I'll file a bug report.

Pond

Re: PNG export broken when area includes images with masks?

Postby Pond » Tue Aug 26, 2008 8:12 pm

I wrote:(...) I'll file a bug report.

Please see https://bugs.launchpad.net/inkscape/+bug/261429.


Return to “Discuss Software Issues”