Converting PDF files to cbz

This is one of those things I am blogging about simply to have ready instructions for the next time I want to do it, so I do not have to go searching google again. What I want to do here is convert comic books that are in PDF format to the more generic cbz format so it can be read by apps like ComicBook Shelf, iComic and some others. The cbz format is simply each page of the comic being saved as a jpeg file, then it is all compressed into one zip file. It is simple enough that the conversion is pretty easy with just a couple of commands, I did not even have to install any extra software. Its so simple I am not even going to explain it, here is the shell script.

#!/bin/sh
mkdir tmp
pdftoppm -jpeg $1 tmp/page
zip $1.cbz tmp/*.jpg
rm tmp/*.jpg
rmdir tmp

Comments are closed.