Posts in "drm"

We don’t need no stinking DRM

I found a book in Amazon Kindle format that I wanted to read. I couldn’t find it anywhere else, and I had some Amazon credits, so I bought it. The problem is, I don’t have a Kindle and don’t want one. I knew that Calibre has plugins to repair DRM-infected Kindle files but found that Amazon made changes to their apps last month that ruined that method. There’s a commercial DRM disinfectant for Macs that I downloaded to test, but it asked for some wild permissions and wanted me to disable SIP. LOL, no. Finally, I took to sailing the seas looking for a usable EPUB, figuring that I already bought a copy and of course it’s morally OK to seek someone else’s assistance in format-shifting my purchase to one I could use. This particular book — I learned of it from the back of a 2600 Magazine — was niche enough that it wasn’t even available that way.

I am not easily dissuaded.

First, I looked up the specs of my Kobo Libra 2 reader. Its screen is 1264x1680 at 300 DPI.

Next, I downloaded the Kindle app for my Mac. I opened the book I had just bought and adjusted the window size until the rectangle of text displayed on my screen was slightly smaller than the Kobo’s screen.

Then I wrote a Keyboard Maestro macro to take a screenshot, save it to an incrementally numbered PNG file, turn the page, wait one second for the page-turning animations to finish, and then repeat the process a few hundred times.

Now that I had screenshots of each page, I used ImageMagick to crop the Kindle app’s window decoration off them, with a script running command lines like:

$ magick kindle-001.png \
    -crop 1248x1597+342+182 +repage \
    -background white \
    -gravity center \
    -extent 1264x1680 \
    prepared/page-001.png

Finally, I combined them all into a single PDF with a command like:

$ img2pdf --imgsize 300dpi prepared/page-* --output mybook.pdf

…and tagged it appropriately with:

$ exiftool \
    -Title="My Book" \
    -Author="Jane Smith" \
    mybook.pdf

The resulting book looks good with crisp text. Although it’s a bunch of screenshots bundled together, it’s still only about 40MB in size and that’s tolerable here.

It would be nicer to have the book as a native EPUB. Since that wasn’t an option, my stubborness won and I made my own version.