Colours in PNG images not displayed properly

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: XnTriq, helmut, xnview

Post Reply
Zefram

Colours in PNG images not displayed properly

Post by Zefram »

Every PNG-image I export from Inkscape (a vector drawing program) is incorrectly displayed in xnview (1.82.2). Grey values appear as black. The curious thing is that the thumbnails are correct!

Example Image:
http://commons.wikimedia.org/wiki/Image ... roblem.png
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: bug with png images

Post by helmut »

Zefram wrote:Every PNG-image I export from Inkscape (a vector drawing program) is incorrectly displayed in xnview (1.82.2). Grey values appear as black. The curious thing is that the thumbnails are correct!

Example Image:
http://commons.wikimedia.org/wiki/Image ... roblem.png
I can confirm. I've downloaded your PNG image and it can be clearly seen that XnView does not display all colours. The image has 578 different colours, whereas XnView counts only 167. :bug: I guess Pierre can say more...
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: bug with png images

Post by xnview »

helmut wrote:
Zefram wrote:Every PNG-image I export from Inkscape (a vector drawing program) is incorrectly displayed in xnview (1.82.2). Grey values appear as black. The curious thing is that the thumbnails are correct!

Example Image:
http://commons.wikimedia.org/wiki/Image ... roblem.png
I can confirm. I've downloaded your PNG image and it can be clearly seen that XnView does not display all colours. The image has 578 different colours, whereas XnView counts only 167. :bug: I guess Pierre can say more...
I can't confirm, i have 580 unique colors, and all is ok...
Pierre.
User avatar
Clo
XnThusiast
Posts: 4441
Joined: Sun Oct 17, 2004 4:57 am
Location: Bordeaux, France
Contact:

Strange PNG…

Post by Clo »

:) Hello !

- I get only 167 colours here like Helmut says (display set @ 16 BPP in the PC) under XP-Pro SP1 - XnView 1.82.4

- Moreover, playing with that image a good while (in the browser >> View etc), I got strange behaviours like : the thumb-nails display delayed by one minute, then a pretty freeze = Alt + Ctrl + Del to kill the process !

- I guess that there is something “abnormal” in that PNG…

:mrgreen: Kind regards,
Old user ON SELECTIVE STRIKE till further notice
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

If Compose image with alpha 32bits (Options » Read » PNG) is activated XnView displays the image correctly. But why isn't 32 bits in the Image menu grayed out?

TweakPNG 1.2.0 says Nachbarschafts-Randproblem.png is a 32-bit RGBA (truecolor + alpha channel) with no bKGD chunk present. I ran a validity check: “No problems found.”

Paint Shop Pro 8.10 counts 166 colors before the alpha channel is removed, and 581 colors once the image is flattened.
I****View 3.91 on the other hand sees 451 unique colors.

I think it boils down to the rather philosophical question whether or not two pixels should be considered as having the same color if one is — for instance — red with an opacity value of 128 (50%), and the another one is red also, but has just 25% (64) opacity.
PNG — The Definitive Guide: [url=http://www.libpng.org/pub/png/book/chapter01.html]Chapter 1. An Introduction to PNG[/url] (??/Jun/1999) wrote:A channel, on the other hand, refers to the collection of all samples of a given type in an image — for example, the green components of every RGB pixel. Thus a truecolor image has three channels, while a grayscale image has only one. (Ordinarily one does not speak of a palette-based image as having channels.) And when discussing transparency, yet another channel type is often used: the alpha channel. This is a special kind of channel in that it does not provide actual color information but rather a level of transparency for each pixel — or, more precisely, a level of opacity, since it is most common for the maximum sample value to indicate that the pixel is completely opaque and for zero to indicate complete transparency. A truecolor image with an alpha channel is often called an RGBA image; grayscale images with alpha channels are rarer and don't have a special abbreviation (although I may refer to them as “gray+alpha”).
[url=http://www.libpng.org/pub/png/spec/1.2/PNG-Glossary.html]Portable Network Graphics (PNG) Specification, Version 1.2[/url] (??/Aug/1999) wrote:Alpha | A value representing a pixel's degree of transparency. The more transparent a pixel, the less it hides the background against which the image is presented. In PNG, alpha is really the degree of opacity: zero alpha represents a completely transparent pixel, maximum alpha represents a completely opaque pixel. But most people refer to alpha as providing transparency information, not opacity information, and we continue that custom here.
[url=http://www.libpng.org/pub/png/spec/iso/index-object.html]Portable Network Graphics (PNG) Specification, Second Edition[/url] (10/Nov/2003) wrote:alpha | a value representing a pixel's degree of opacity. The more opaque a pixel, the more it hides the background against which the image is presented. Zero alpha represents a completely transparent pixel, maximum alpha represents a completely opaque pixel.
A Guide to Inkscape: Glossary wrote:alpha | The transparency of an object (or pixel). If an object with a non-maximal value of alpha is placed over another object, the second object will be visible under the first. In Inkscape a value of Alpha of 255 means the object is completely opaque while a value of 0 means it is fully transparent (not visible).
Last edited by XnTriq on Sun Mar 26, 2006 3:05 pm, edited 1 time in total.
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

XnTriq wrote:If Compose image with alpha 32bits (Options » Read » PNG) is activated XnView displays the image correctly. But why isn't 32 bits in the Image menu grayed out?
Right it's a 32bits png file....
Pierre.
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

xnview wrote:
XnTriq wrote:If Compose image with alpha 32bits (Options » Read » PNG) is activated XnView displays the image correctly. But why isn't 32 bits in the Image menu grayed out?
Right it's a 32bits png file....
:) Hi Pierre!

When I open a 32-bit image in View mode and pull down the Image menu, the True Colour (= 24-bit truecolor) option is grayed out, while the 32 bits (= 32-bit truecolor) option is not.
Please correct me if I'm wrong, but shouldn't it be the other way around, because the color depth of the image can only be decreased?
User avatar
Clo
XnThusiast
Posts: 4441
Joined: Sun Oct 17, 2004 4:57 am
Location: Bordeaux, France
Contact:

Not here

Post by Clo »

—> XnTriq

:) Hello !

- I just tested again with normal 32 BPP PNGs : the 32-bit entry is blurred alright like it should, while the True colour one is active…

:mrgreen: Kind regards, cordialement,
Claude
Clo
Old user ON SELECTIVE STRIKE till further notice
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

:) Hi Clo!

Thanks for the tip. In the meantime I've been fooling around with these 32-bit RGBA PNGs from the official PNG site.

XnView indicates 32-bit color depth in the status bar only when Compose image with alpha (32bits) is deactivated. Areas with 100% transparency (or zero opacity) appear as black. Image » 32 bits is grayed out, True Colour is not.
In all other configuration settings they're handled as if they had 24-bit color depth, and transparent areas are displayed as white.

:?: Could this be a solution to the problem described by Zefram:
Inkscape Wiki FAQ wrote:Q: The PNGs exported by Inkscape have jagged edges/no antialiasing/funny background.

[...]

If you want to open the exported PNG bitmaps in MS-Word, you will also have to change the alpha-opacity (in document-properties dialog) to full, and then export — the result will be much better.
:arrow: Related discussions:
Last edited by XnTriq on Sun Apr 02, 2006 3:30 pm, edited 3 times in total.
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

XnTriq wrote:
xnview wrote:
XnTriq wrote:If Compose image with alpha 32bits (Options » Read » PNG) is activated XnView displays the image correctly. But why isn't 32 bits in the Image menu grayed out?
Right it's a 32bits png file....
:) Hi Pierre!

When I open a 32-bit image in View mode and pull down the Image menu, the True Colour (= 24-bit truecolor) option is grayed out, while the 32 bits (= 32-bit truecolor) option is not.
Please correct me if I'm wrong, but shouldn't it be the other way around, because the color depth of the image can only be decreased?
But do you have "compose image with alpha"???
Pierre.
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

http://www.libpng.org/pub/png/images/balloons-aj.png

Code: Select all

Chunk | Contents
------+-----------------------------------------------------------------------
IHDR  | PNG image header: 80x87, 8 bits/sample, truecolor+alpha, noninterlaced
sBIT  | significant bits/sample: R:8,G:8,B:8,A:8
tEXt  | standard text: [Software]=[www.inkscape.org]
IDAT  | PNG image data
IDAT  | PNG image data
IEND  | end-of-image marker

TweakPNG 1.2.1
  • Image
+ + +

http://www.libpng.org/pub/png/img_png/s ... l_rgba.png

Code: Select all

Chunk | Contents
------+----------------------------------------------------------------------
IHDR  | PNG image header: 162x150, 8 bits/sample, truecolor+alpha, interlaced
gAMA  | file gamma = 1.00000
IDAT  | PNG image data
IDAT  | PNG image data
IDAT  | PNG image data
IDAT  | PNG image data
IEND  | end-of-image marker

TweakPNG 1.2.1
  • Image
_________________________________________________________________
Intel 82815 Graphics Controller 6.13.1.3196 • Windows 2000 SP4 • XnView 1.82.4
Post Reply