-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PNG files are often corrupted when inputs are monochrome. #426
Comments
Just as a note, multiple other PNG tools have real problems with 1-bit/2-bit grayscale PNGs, so it'd be amazing to have 1 that works well w/ them! 🙇🏾♂️ |
@tommyettinger the images you uploaded are for some reason gifs, not pngs. |
Whoops, on it. I generate both. I'll edit the original post. |
Tried two images and everything seems to be working fine (oxipng 5.0.1 on Linux downloaded from the releases)
|
So, maybe a Windows-build-only problem? @tommyettinger Did you ever try it 1 PNG @ a time, or only via glob-match? |
I am also unable to reproduce this on Windows. I've tried using both a binary that I compiled myself, and the binary posted on the releases page. |
I keep screwing this up, I am so sorry; I forgot that I had run
Before apngopt gets to these, the images are considered 8-bit-depth indexed-color PNGs; after apngopt is run, they become 8-bit-depth grayscale PNGs. I can run oxipng fine on the original files if I didn't run apngopt after generating them. Here's the .zip of the problem files, after apngopt appears to have corrupted them: Feel free to close this issue if you agree that the problem lies outside oxipng. EDIT: Sorry I forgot to reply to @TPS ; I did try with single files (no glob) and it has the same problems with apngopt output. |
Interesting. It does seem like there is potentially a problem with apngopt. However, if the png files are able to be parsed and displayed by an image viewer, which it seems they are, then oxipng should also be able to handle them gracefully. So I think there is some work to be done here on our side. Or at least more investigation into the bytes of the file, why this is being output differently than it's going in. |
That seems like a good approach to take. It also might help everyone understand the nature of the corruption, so apngopt can maybe fix it more easily. I used apngopt 1.4 , by the way. |
It turns out this is a bug in oxipng - see the explanation and fix in #470. |
I don't know what's happening here, but I ran the command line
oxipng -s -o 6 -Z --fix *BW.png
in an attempt to figure out why earlier runs (without-Z
, as well as with and without-D
) had some corrupt images, but only for monochrome black and white PNGs (1-bit). All of the attached PNGs had corrupt output when given the above command line. I an on Windows 10 64-bit, and used a just-downloaded 5.0.1 release. Zopfli compression claimed it had significant size reductions, but then also that the output was corrupted and so was not saved. I don't have a Rust dev environment set up, and I suspect compiling oxipng from source would be a challenge for me, so I guess I'm just reporting what it says to report, and providing some of the images that failed.EDIT: I originally uploaded GIFs, not PNGs, though the contents were identical. Sorry about that!
The text was updated successfully, but these errors were encountered: