How to convert cbr to pdf?

I have a comic strip book in cbr (Calibre?) format. How can I convert it to pdf in my Ubuntu 12.04? I tried to install calibre hoping that it is able to do so. But it seems to be buggy and does not show up. Appreciate your hints to do the conversion.


Found a nifty way to do this. Programs that you might need are rar and imagemagick.

sudo apt-get update
sudo apt-get install rar imagemagick

Next, rename all the files extension that you want to convert, from *.cbr to *.rar.

Example: comic.cbr --> comic.rar

Next, use rar and extract all the .rar files. You should get .jpg files as output.

Next, use imagemagick to covert all into one. Make sure you are in that directory.

Example use in terminal:

convert *.jpg comic.pdf

Unfortunately convert and calibre changes the image quality/resolution, which is very important to CBR and CBZ, so to have no loss of quality, practically using the original jpg that is inside the CBR(CBZ) files you need to use img2pdf, I use this commands:

First need to install this:

sudo apt install img2pdf p7zip-full

1) This to make a pdf file out of every jpg image without loss of either resolution or quality:

ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf

2) This to concatenate the pdfpages into one:

pdftk *.pdf cat output combined.pdf

I made this batch files

./cbr2pdf.sh:

#!/bin/bash
set -xev
ORIGINAL_FOLDER=`pwd` 
JPEGS=`mktemp -d`
cp "$1" "$JPEGS"
cd "$JPEGS"
7z e "$1" 
ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf
pdftk *.pdf cat output combined.pdf
cp "$JPEGS/combined.pdf" "$ORIGINAL_FOLDER/$1.pdf"

cat cbz2pdf.sh

#!/bin/bash
#set -xev
ORIGINAL_FOLDER=`pwd` 
JPEGS=`mktemp -d`
unzip -j "$1" -d "$JPEGS"
cd "$JPEGS"
ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf
pdftk *.pdf cat output combined.pdf
cp "$JPEGS/combined.pdf" "$ORIGINAL_FOLDER/$1.pdf"

To convert all cbr and cbz in folder and subfolders:

tree -fai . | grep -P "cbr$" | xargs -L1 -I{} ./cbr2pdf.sh {}

and

tree -fai . | grep -P "cbz$" | xargs -L1 -I{} ./cbz2pdf.sh {}

I'm using ubuntu 12.04 and calibre did the job perfectly for me. Your problem is installing calibre. If I'm not wrong I managed to install it by upgrading python


Just found another command line tools that works great http://sharedby.jauco.nl/cbr2pdf

you can install in /usr/bin

I requires some packages that you can install with

sudo apt-get install pdftk sam2p unrar unzip

Then just launch

cbr2pdf [file.cbr]

To have file.pdf on the same directoy