Quote:
Originally Posted by jcsalomon
I’ve also gotten conflicting suggestions on PNG vs. GIF, and searching this forum doesn’t yield anything that looks authoritative. PNG it is for now, unless I get a good reason to change.
|
PNG is the superior format, and it can do everything GIF can do better (besides animation... which doesn't apply in EPUBs).
- Color
- GIF: Up to 256 colors.
- PNG: Millions of colors.
- There is also Indexed PNGs (up to 256 colors), which encompasses the entirety of GIF.
- Transparency
- GIF: Either on/off (and hackish).
- PNG: Has an entire Alpha channel (8-bit transparency).
- Compression
- GIF: None or LZW.
- PNG: A multitude of different types of compression algorithms can be used.
- As an example, in 2013 Google released the Zopfli compression algorithm, which compresses ~3-8% more than the previous best algorithms.
- In almost all cases, the equivalent PNG will be smaller than the GIF. (GIF only wins in very tiny icon-sized images because of less overhead).
Quote:
Originally Posted by jcsalomon
Seems I have a partial answer to image transparency, at least. The release notes for Kindlegen version 2.5 build 0626-3a91e28 includes
[...]
So not only will the transparency not work, it will also trigger a PNG→JPEG conversion. (ETA: Experimentation shows that kindlegen actually converts to a GIF image, without transparency.)
|
Hmmm, that is good to hear they at least convert it to GIF. Although GIF transparency =/= PNG transparency.
When I wrote my "Tutorial: Formulas to PNG", KindleGen still converted Transparent PNG -> JPG, which was just PREPOSTEROUS:
https://www.mobileread.com/forums/sho...d.php?t=223254
I haven't really tested it since then, and have been converting all transparent formulas -> white background beforehand. (It also compresses much better, and Indexed PNGs with transparency are... it depends [see the thread for the Kindle black box bug I ran into depending on the PNG compression tool]).
Quote:
Originally Posted by jcsalomon
Image color: The images are scanned gray-scale line-art. [...] I understand that gray-scale PNG is the best format for this, but should I leave it as black & gray on white, or convert to transparent?
|
For those types of images, you could save them as Grayscale PNGs (lossless)... or I recommend converting them to Indexed PNG (lossy). You can lower the amount of grays to <=256 (see my Tutorial above).
Bug to watch out for: Depending on which PNG compression tools you use, you should probably avoid 2-bit (4 color) and 4-bit (16 color) PNGs as some devices have display bugs. See GrannyGrump's topic here:
https://www.mobileread.com/forums/sho...d.php?t=222916
I personally just settled on 17 color Indexed PNGs. But anywhere from 17-256 Indexed colors should be safe (since this forces it to be an 8-bit PNG).