Does PNG actually support an 8-bit format with 8-bit alpha or just 1-bit alpha? If the latter, then IM has a bug.
Consider:
convert logo: -transparent white -alpha on -channel a -blur 0x1 +channel -type palettematte logo1.png
or
convert logo: -transparent white -alpha on -channel a -blur 0x1 +channel -type palettealpha logo1.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 640x480+0+0
Units: Undefined
Type: PaletteAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 8-bit
vs
convert logo: -transparent white -alpha on -channel a -blur 0x1 +channel PNG8:logo2.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 640x480+0+0
Units: Undefined
Type: PaletteAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Both display, although the former does not look as good as the latter --- the former has lots of black spots.
IM 6.8.8.7 Q16 Mac OSX Snow Leopard
Question about PNG 8-bit format with alpha
Re: Question about PNG 8-bit format with alpha
It's not a bug it's a design choice. There is no approved definition of PNG8 so I defined it for
ImageMagick purposes. Type "convert -list format | grep PNG8". The main purpose
of the subformat is to write files to be read by a commonly used browser that didn't support
indexed PNG with alpha other than 0 and 255.
ImageMagick purposes. Type "convert -list format | grep PNG8". The main purpose
of the subformat is to write files to be read by a commonly used browser that didn't support
indexed PNG with alpha other than 0 and 255.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Question about PNG 8-bit format with alpha
glennrp wrote:It's not a bug it's a design choice. There is no approved definition of PNG8 so I defined it for
ImageMagick purposes. Type "convert -list format | grep PNG8". The main purpose
of the subformat is to write files to be read by a commonly used browser that didn't support
indexed PNG with alpha other than 0 and 255.
Glenn,
Thanks. But why is the -type palettematte approach giving black spots rather than either partial transparency or solid colors?
Fred
Re: Question about PNG 8-bit format with alpha
I don't know. The "pngquant" program does a nicer job:fmw42 wrote:[why is the -type palettematte approach giving black spots rather than either partial transparency or solid colors?
Code: Select all
convert logo: -transparent white -alpha on -channel a -blur 0x1 \
+channel logo.png
pngquant logo.png
values of alpha contained in the tRNS chunk. I have been considering
defining a "PNG88" that would be like "PNG8" but would allow
semitransparency.
Our png reader seems to have trouble with reading these, though,
so first I'll see about fixing that bug.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Question about PNG 8-bit format with alpha
Thanks Glenn. I did not mean to put you to a lot of work. I was just curious, since I did not think IM allowed 8-bit color and 8-bit alpha in PNG.
But this would be nice additional feature.
But this would be nice additional feature.
Re: Question about PNG 8-bit format with alpha
IM allows 8-bit color and 8-bit alpha, but it's not called "PNG8" if there is full alpha. It's currently not 100% convenient to write them from IM, though. You have tofmw42 wrote:Thanks Glenn. I did not mean to put you to a lot of work. I was just curious, since I did not think IM allowed 8-bit color and 8-bit alpha in PNG.
quantize the image down to 255 or fewer different RGBA pixel values (-colors 255), and you have to worry about RGB vs sRGB issues, and whether to dither or not.