Last Updated on May 4, 2022
We’ve previously written about good open source software that batch converts image files. Batch conversion offers lots of benefits. Batch image converters let you process hundreds or thousands of images with a few clicks or even a single command. By optimizing image files that are displayed on websites, bandwidth is conserved, storage space is conserved, and sites load faster, which will help to provide a better end user experience.
The last time we surveyed the scene (article: Save Time and Effort with these Excellent Batch Image Processors) there was a fairly limited range available to recommend. But I want to recommend a further utility. It’s called imgp, a Python-based command-line tool that lets you resize and rotate JPEG and PNG files. The software can resize (or thumbnail) thousands of images with a single command. The software is a standalone utility, it’s not tied to a file manager or other software.
imgp was previously called imgd.
Installation
Packages for Arch Linux, CentOS, Debian, Fedora, openSUSE Leap and Ubuntu are available.
If your distribution doesn’t carry the latest version, you can clone the software’s GitHub repository.
cd imgp
You can copy the imgp file into a directory in your PATH. There’s nothing to compile. imgp requires Python 3.5 or later.
In operation
If you type imgp at a shell, the software outputs the various flags that are available. There’s a pretty good range available with this tool.
The output below shows imgp in action, resizing a directory of png files that are at least 50KB in size.
Features of imgp include:
- Resize by percentage or resolution.
- Rotate clockwise and anti-clockwise by specified angle.
- Adaptive resize considering orientation.
- Brute force to a resolution.
- Optimize images to save more space.
- Limit processing by minimum image size.
- Nearest neighbor interpolation for PNG files – a simple method of multivariate interpolation in one or more dimensions.
- Convert PNG images to JPEG format.
- Support for progressive JPEG files, images created using compression algorithms that load the image in successive waves until the entire image is downloaded. The website visitor perceives the image loads faster as they see the whole image straight away.
- Erase exif metadata. This metadata contains information about the device that took the picture, the dimensions of the image and, when available, GPS coordinates identifying the location where the picture was taken.
- Specify output JPEG image quality.
- Force smaller to larger resize.
- Process directories recursively. If you need to convert a lot of images in nested directories, this option is a massive time saver.
- Overwrite source image option.
- Completion scripts for bash, fish, zsh.
- Identifies Multi Picture Object (MPO) files, a multi-image extension of the JPEG image format. This extension is often used for stereoscopic images.
- Minimal dependencies.
Summary
If you need to process a bunch of PNG or JPEG files, imgp is a handy utility.
Arun Prakash Jana is notable for coding other useful open source software. In particular, I’m a regular user of his nnn, a fast console based file manager, and googler, a console based utility tool to Google from the command-line.
Website: github.com/jarun/imgp
Support:
Developer: Arun Prakash Jana and contributors
License: GNU General Public License v3.0
imgp is written in Python. Learn Python with our recommended free books and free tutorials.