Install img2pdf on Raspberry Pi

Install img2pdf on Raspberry Pi

The img2pdf is a command line tool that allows to convert images (JPEG, PNG, etc.) to PDF file. This tool performs a lossless conversion. The images included in the PDF file has the same color information for each pixel like an original images.

This tutorial demonstrates how to install img2pdf on Raspberry Pi.

Connect to Raspberry Pi via SSH. Update the package lists and install img2pdf by using the following commands:

sudo apt update
sudo apt install -y img2pdf

Once the installation is complete, we can check img2pdf version:

img2pdf --version

Now download few images from the Internet:

wget -O test1.png https://raw.githubusercontent.com/opencv/opencv/master/samples/data/sudoku.png
wget -O test2.jpg https://raw.githubusercontent.com/opencv/opencv/master/samples/data/board.jpg

Execute the img2pdf command to convert images to PDF file. The images is given as arguments. The -o option is used to provide the output file.

img2pdf test1.png test2.jpg -o test.pdf

We can also convert all images stored in the current directory to PDF file as follows:

img2pdf *.png *.jpg -o test.pdf

If you want to completely remove img2pdf and related dependencies, run the following command:

sudo apt purge --autoremove -y img2pdf

Leave a Comment

Cancel reply

Your email address will not be published.