Page 2 of 2

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-09T04:56:15-07:00
by glennrp
Removing "-type palettematte" gives a transparent top and bottom,
and the resulting PNG is still color_type 3 with tRNS (indexed palette).

There are some longstanding unresolved problems with the the way
the PNG encoder handles the -type palettematte option.

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-09T06:38:28-07:00
by kreynolds
I have found a few additional examples of converting assets to indexed that cause similar but slightly different corruption but what I'm hearing is "Stop doing that, it's broken and won't be fixed soon." Does that about sum it up?

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-09T13:04:22-07:00
by glennrp
That's pretty much it. It'll be fixed the day after I figure out how.

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-09T13:10:23-07:00
by kreynolds
Is there anything I can do to help with this or is this just something that requires a moment of inspiration on some future date?

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-09T16:48:33-07:00
by fmw42
kreynolds wrote:Is there anything I can do to help with this or is this just something that requires a moment of inspiration on some future date?

Seems like the current issue for this topic is solved by removing the -type palettmatte and adding PNG8:

convert ribbon.png -alpha off -colors 255 \
-background none -gravity center -extent x48 \
-depth 8 PNG8:ribbon_out.png

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-09T17:18:57-07:00
by kreynolds
I wish it did. I've since found a few other assets that have similar problems though corrupt in different ways than this one. Removing -type palettematte does not fix them and some of them have actual alpha layers. I can add them here or start a new thread but I imagine the advice will be the same either way.

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-09T18:56:35-07:00
by fmw42
kreynolds wrote:I wish it did. I've since found a few other assets that have similar problems though corrupt in different ways than this one. Removing -type palettematte does not fix them and some of them have actual alpha layers. I can add them here or start a new thread but I imagine the advice will be the same either way.
Sorry, I only meant this one issue was fixed by this approach. As Glenn said, he knows of other issues as well.

Probably would be best to start a new thread about those other issue.

Re: PNG file corrupts strangely when indexing

Posted: 2011-08-10T19:45:35-07:00
by glennrp
The "-type PaletteMatte" option started misbehaving (discarding transparency) in IM-6.6.9-4
apparently due to a small change in quantize.c having to do with how it handles images
with a small number of colors. This happened not only with PNG output
but with TXT output.

As of IM-6.7.1-5 the "-type PaletteMatte" option seems to be working OK; however,
the original problem with -colors 255 still exists and is apparently not a PNG encoder
problem because MIFF and TXT output are the same as the PNG output.

Re: PNG file corrupts strangely when indexing

Posted: 2011-09-08T17:48:30-07:00
by fmw42
Glenn,

-type palettematte seems to be broke again in IM 6.7.2.3 Q16 (HDRI) Mac OSX Tiger:

This works with PNG8:

convert logo: -transparent white PNG8:logotp.png
identify -verbose logotp.png
Image: logotp.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 640x480+0+0
Resolution: 72x72
Print size: 8.88889x6.66667
Units: Undefined
Type: PaletteMatte
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Red:
min: 4 (0.0156863)
max: 255 (1)
mean: 229.323 (0.899307)
standard deviation: 69.3423 (0.271931)
kurtosis: 4.45973
skewness: -2.49768
Green:
min: 0 (0)
max: 255 (1)
mean: 226.217 (0.887127)
standard deviation: 70.8689 (0.277917)
kurtosis: 3.37246
skewness: -2.24758
Blue:
min: 0 (0)
max: 255 (1)
mean: 229.064 (0.898288)
standard deviation: 64.1018 (0.251379)
kurtosis: 4.65272
skewness: -2.42185
Alpha:
min: 0 (0)
max: 255 (1)
mean: 42.2975 (0.165872)
standard deviation: 94.8513 (0.371966)
kurtosis: 1.22759
skewness: -1.79655

Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 224.327 (0.879712)
standard deviation: 75.7241 (0.296957)
kurtosis: 3.46137
skewness: -2.27992


But this does not work with -type palettmatte


convert logo: -transparent white -type palettematte logo2tp.png
identify -verbose logo2tp.png
Image: logo2tp.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 640x480+0+0
Resolution: 72x72
Print size: 8.88889x6.66667
Units: Undefined
Type: Palette
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 4 (0.0156863)
max: 255 (1)
mean: 229.323 (0.899307)
standard deviation: 69.3408 (0.271925)
kurtosis: 4.45939
skewness: -2.49762
Green:
min: 0 (0)
max: 255 (1)
mean: 226.217 (0.887126)
standard deviation: 70.8691 (0.277918)
kurtosis: 3.37237
skewness: -2.24757
Blue:
min: 0 (0)
max: 255 (1)
mean: 229.063 (0.898288)
standard deviation: 64.1009 (0.251376)
kurtosis: 4.65193
skewness: -2.42173
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 228.201 (0.894907)
standard deviation: 68.1652 (0.267315)
kurtosis: 4.14785
skewness: -2.39282

Fred

Re: PNG file corrupts strangely when indexing

Posted: 2011-09-09T09:48:38-07:00
by glennrp
This also loses transparency in IM-6.7.2-3 Q16

Code: Select all

convert logo: -transparent white -type palettematte logo2tp.miff
identify -verbose logo2tp.miff
and so does .txt