0
Fixed

Certain PNG Files Display Colors Incorrectly

Bee Guperjee 9 years ago updated by Tom 9 years ago 10
I've got a few books that Ubooquity displays with incorrect colors. These are all archives with png files with the IHDR color type set to 6. Png files with color type 2 display correctly. Here's a screenshot showing the bad colors. Left is png color type 6 and the right is color type 2. The incorrect colors are present when opening the books to read as well. And thanks for Ubooquity. It makes reading digital comics from my library on my tablet quite easy.

Image 20
That is interesting. I've seen the same problem with covers I have added to epubs displaying like this in my Calibre OPDS pages. And those are jpegs, never saw a rhyme or reason for the ones that displayed this way, but your observation may get me looking closer.

FWIW, I have this same book downloaded from DCM (yours may be a different version) and the cover does not display like this in my Ubooquity instance.
I've only noticed it with png files. Changing the png metadata color type to 6 produces the colors shown in the screenshot. Color type 6 includes an alpha channel along with the rgb data. As far as png files go, it must be caused by the alpha channel as color type 2, rgb without the alpha, displays correctly. At least that's what I've concluded after some brief testing of changing png metadata settings.
Under review
I have been able to reproduce the bug with PNG having an alpha channel. Thanks for the very accurate description by the way, it helps a lot.
I'll try to find a way to fix it.

As far as I know the bug only exists for PNG files. If you have this problem with other formats, please let me know (Jim, your problem is with Ubooquity or with Calibre ?).
No, my issue is with Calibre only:



Ubooquity is just fine:




I think it is a Calibre thumbnail creation issue. It is such an odd problem I was hoping I might get an idea why it is happening there. Didn't mean to cloud the problem.


You did not. :)
I was asking because there was a similar problem in earlier versions of Ubooquity with JPEG files. I had to use a specific decoding library to get rid of the pink overlay that appeared for JPEG files that were using a special kind of color profile. I just wanted to be sure that this problem had not reappeared.

As for Calibre, the problem seems different (no pink overlay) and in any case the platform used for its development is not Java but Python. It probably has something to do with color profiles, but I can't be of any help (I have no knowledge of Python).
Ok, my issue with Calibre (NOT Ubooquity) was that the covers that appeared to be a negative image were, in fact, derived from CMYK files, not RGB. This is handled perfectly by Ubooquity. Calibre (or whatever library it is using in linux) choked on the creation of the CMYK thumbnail in its web content server. It's a shame, too as the colors are so much more vibrant. In any case, the pretty ones are saved into the epubs themselves. I'm just happy this post got me investigating why they were acting this way. Thanks!
Glad you found an answer to your chroma crisis! (Sorry about the alliteration. Too much Stan Lee will rot your brain.) And thanks Tom for working on this.