Skip to main content

Command Palette

Search for a command to run...

Playing with PDFs & Images in Linux

Published
2 min read
Playing with PDFs & Images in Linux

Linux open source applications allows a wide range of customisation just by tweaking simple settings and you will not have roam any further shady websites to do your work of pdfs.
Everything you can imagine will happen inside your computer locally.

For this we will be installing following tools

sudo dnf install img2pdf # Fedora
sudo apt install img2pdf # Ubuntu / Debian
sudo dnf install ImageMagick # Fedora
sudo apt install ImageMagick # Ubuntu / Debian

Task 1:- Converting Images into PDF

Suppose we took a lot of screenshots and want to convert it into pdf in a easy and user-friendly manner

  • We will firstly move all the files to a demo folder

  • Then we will select all the files and use the rename feature to rename them on the basis of a specific pattern

    After that we will open the terminal in that directory and type the following command

      img2pdf *.png -o output.pdf
    

    Boom!! Your pdf is generated.

Task 2:- Inverting the Colours of PDFs and Images

→ Inverting the colours of a Image

magick input.png -channel RGB -negate output.png

→ Inverting the colours of pdf

magick input.pdf -channel RGB -negate output.pdf

Task 3: Converting between image file formats

magick input.png output.jpg

Task 4: Compressing Images and PDFs

→ Compressing Images

Adjust the below settings as per your use cases

convert input.jpg -resize 50% -quality 70 output.jpg

Batch Compress multiple pages

mogrify -resize 50% -quality 70 *.jpg

→ Compressing PDFs

convert input.pdf -quality 70 output.pdf