During our job or studies, we often process PDF files and images. These tasks include PDF merging, splitting, page removal, file size reduction, image cropping, etc.
When you send an application out you might need your passport size photogram to be of certain dimension and file size. You might need to convert some documents or images into PDFs so that it is easily viewable by the recipient.
There are some handly tools online for these but you might have a privacy concern and may not want to expose your data online.
In this short blog post, I am listing down some free and opensource offline tools and their use cases. These tools can be used regardless of the operating system.
The chrome browser will be one of the key tool in our arsenal. It is cross-patform (Windows, Linux and Mac), free and have mutiple usecases.
Image to PDF
In this example, let us see how to easily convert an image to PDF format. In order to do that we simply need to open a new window in chrome browser and open the image in it as shown below.
This will open the particular image in chrome. Now by going to the File menu and print, we can print the file in PDF format.
Now by selecting the save as PDF option and pressing the save button, the file will be saved to the folder location you provide.
This method works with multiple image formats such as jpeg, png, svg, and even with txt files also.
PDF page selection/removal
This same method can be used to select only specific pages from a PDF file and save it as a separate file.
Here in the pages window, we have options like even pages only or odd pages only, or custom page numbers. Here I am selecting pages 2,3, and 5 of the PDF I am interested in and saving it as a new PDF file. This way you can select specific pages and omit one or more pages you which you don’t want in the final PDF.
File (PDF/image) Size Reduction
This tool is an open-source command line tool to reduce file size. It works for PDFs as well as images. I have used it in both Ubuntu and Mac and the same for Windows OS is also available. binary files and instructions are available here (https://imagemagick.org/script/download.php). Once installed, a simple usage example is shown below.
We have to navigate to the folder where the pdf file exists using the terminal and give command like below.
convert -density 300 sample_file.pdf -quality 80 sample_file_processed.pdf
for images, use
convert -density 300 sample_image.png -quality 80 sample_file_image.jpeg
The density parameter allows us to control the Dots Per Inch (DPI) value and by setting the quality parameter we can control the output file size. To reduce file size to the desired level, we need to experiment with the quality parameter we have.
Another command line tool to combine multiple PDFs into one is pdfunite. It is available in Ubuntu built-in. It can be installed in mac using ‘brew’ command. The use case is similar to the ‘convert’ command and is shown below.
pdfunite sample_file_1.pdf sample_file_2.pdf combined.pdf
Here the two pdfs are merged together to form the combined pdf.
Image Cropping and Dimension Change
One free and open-source tool to crop images and change their dimensions is GIMP.
GIMP can be downloaded (Linux/Windows/Mac) from the link https://www.gimp.org/downloads/
It is straightforward to crop images in GIMP using its graphical Photoshop-like tools.
These are some of the tools which came in handy for me many times. In one of our future posts, we will see tools with which we can create block diagrams, flowcharts, and publication-quality technical diagrams.