How To Install python3-img2pdf on Ubuntu 18.04

In this tutorial we learn how to install python3-img2pdf on Ubuntu 18.04. python3-img2pdf is Lossless conversion of raster images to PDF (library)

Introduction

In this tutorial we learn how to install python3-img2pdf on Ubuntu 18.04.

What is python3-img2pdf

python3-img2pdf is:

This module will take a list of raster images and produce a PDF file with the images embedded in it. JPEG and JPEG2000 images will be included without recompression. Raster images in other formats will be included with zip/flate encoding which usually leads to an increase in the resulting size because formats like png compress better than PDF which just zip/flate compresses the RGB data. As a result, this module is able to losslessly wrap images into a PDF container with a quality to filesize ratio that is typically better (in case of JPEG and JPEG2000 images) or equal (in case of other formats) than that of existing tools.

Img2pdf includes its own PDF writer but will use the pdfrw module if available instead.

This package contains the Python library.

There are three methods to install python3-img2pdf on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python3-img2pdf Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python3-img2pdf using apt-get by running the following command:

sudo apt-get -y install python3-img2pdf

Install python3-img2pdf Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python3-img2pdf using apt by running the following command:

sudo apt -y install python3-img2pdf

Install python3-img2pdf Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python3-img2pdf using aptitude by running the following command:

sudo aptitude -y install python3-img2pdf

How To Uninstall python3-img2pdf on Ubuntu 18.04

To uninstall only the python3-img2pdf package we can use the following command:

sudo apt-get remove python3-img2pdf

Uninstall python3-img2pdf And Its Dependencies

To uninstall python3-img2pdf and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python3-img2pdf

Remove python3-img2pdf Configurations and Data

To remove python3-img2pdf configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python3-img2pdf

Remove python3-img2pdf configuration, data, and all of its dependencies

We can use the following command to remove python3-img2pdf configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python3-img2pdf

References

Summary

In this tutorial we learn how to install python3-img2pdf package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.