A small shell script that fixes garbled/broken image rendering on (older) Kindle devices of PDFs purchased on Leanpub, due to some issue with Kindle's method of processing PNG files.
Using Ghostscript, this script will convert all images inside the PDF to JPEG using highest quality conversion.
This will result in smaller output PDF size, and will make the images render properly on older Kindles (e.g. Kindle DX)
$ pdfix.sh input.pdf
Will produce a file input-fixed.pdf
in the same directory.
Ghostscript installation is required! Install on macOS using Homebrew:
brew install ghostscript
Or on Ubuntu / Bash on Windows (WSL) using:
sudo apt-get install ghostscript
(not tested on Windows, but should work!)
Before (11.1MB) | After (7.23MB) |
---|---|