kornelski / mediancut-posterizer

Lossy PNG compressor for RGBA PNGs. Has two modes: lossy averaging filter (blurizer) that denoises the image and optimal posterization using Median Cut quantization to reduce number of unique colors in the image with minimal visual distortion
https://pngmini.com
236 stars 32 forks source link

Error: cannot read PNG from stdin #1

Closed pngqu closed 11 years ago

pngqu commented 11 years ago

Hola, Running it on Windows: posterize.exe -q 90 < before.png > after.png

I got: "Error: cannot read PNG from stdin".

kornelski commented 11 years ago

Perhaps it's the LF<>CRLF conversion done in "text mode". Try setting binary mode, like pngquant does:

https://github.com/pornel/improved-pngquant/blob/master/pngquant.c#L860

pngqu commented 11 years ago

Sorry but i do not understand (im not a programmer). I need some help please. I've tried:

If i have to modify something in the posterize.c, i do not know what i've to change. Thanks in avance.

kornelski commented 11 years ago

Try compiling code from this branch:

https://github.com/pornel/mediancut-posterizer/tree/win32

pngqu commented 11 years ago

Thanks. It works now. Is that a chance that posterize only work in the RGB channel (not the alpha) ? It's very efficient but it also damage the alpha too much. I've tried:

after

kornelski commented 11 years ago

Can you share the compiled executable?

Posterization gives best compression when it's applied to all channels. If something looks bad, then increase number of posterization levels.

kornelski commented 11 years ago

Latest version has better handling of gamma correction, which improves alpha at the same time