How to Resize Images by Command line in Ubuntu

imgp command line tool lets you resize images from the Terminal.

If you have been following us, you might have seen our article on how to add resize option in the right-click context menu in the File manager in Ubuntu. Today, let’s talk about how to resize images by command line via Terminal. Command line way of doing things have their own advantages. In most of the cases, it is highly efficient to use command line when doing things from a remote computer. Also, Terminal consumes the least amount of system resources and is lightning fast.

Resizing images from the Terminal in Ubuntu

To resize images from the terminal, we will be using a free command line utility called imgp. This amazing utility supports batch processing of images and uses the intelligent adaptive algorithm.

Features of imgp

Though the name of the utility could have been better, the features aren’t compromised.  imgp is a good replacement of the Nautilus Image Converter extension because it is not tied to any file manager and so way faster in conversion.

Let’s take a look at its powerful features.

  • supports JPEG and PNG image formats
  • can resize by percentage or resolution
  • supports batch processing of images
  • preserves/ erase EXIF data
  • can rotate images clockwise by the specified angle
  • optimize images
  • specify output JPEG quality
  • completion scripts for bash, fish, zsh

Installation of imgp in Ubuntu, Linux Mint, and elementary OS

The easiest way to install imgp is to via PPA.

Step 1) Launch Terminal.

Step 2) imgp needs Python 3.5 or later, which is installed by default in recent versions of Ubuntu, but in any case, there is no harm in entering this command:

sudo apt-get install python3-pil

Step 3) Use the following command to add PPA.

sudo add-apt-repository ppa:twodopeshaggy/jarun

Step 4) Update:

sudo apt update

Step 5) Install imgp

sudo apt install imgp

That’s it! You can now use the command line to start resizing your images.

How to use imgp

Convert some images and directories:

imgp -x 1366x768 ~/ ~/Pictures/image3.png ~/Downloads/
3840x2160 -> 1365x768
11104999 bytes -> 1486426 bytes

2048x1365 -> 1152x768
224642 bytes -> 31421 bytes

1920x1080 -> 1365x768
2811155 bytes -> 1657474 bytes

2048x1365 -> 1152x768
224642 bytes -> 31421 bytes

Scale an image by 75% and overwrite the source image:

imgp -x 75 -w ~/image.jpg
1366x767 -> 1025x575
120968 bytes -> 45040 bytes

Rotate an image clockwise by 90 degrees:

imgp -o 90 ~/image.jpg
120968 bytes -> 72038 bytes

Adapt the images in the current directory to 1366×1000 resolution.

Visit all directories recursively, overwrite source images, ignore images with matching hres or vres but convert PNG images to JPEG.

imgp -x 1366x1000 -wrack
Set hres=800 and adapt vres maintaining the ratio.

imgp -x 800x0
Source omitted. Processing current directory...

1366x911 -> 800x534
69022 bytes -> 35123 bytes

1050x1400 -> 800x1067
458092 bytes -> 78089 bytes

Process images greater than 50KB (50*1024 bytes) only:

imgp -wrackx 1366x1000 -s 51200


Kiran Kumar
Hi there! I'm Kiran Kumar, founder of I'm an avid Linux lover and enjoy hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities, especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. I hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more and spread Linux love!. If you find a time, drop me an email or feedback from the 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!


Please enter your comment!
Please enter your name here





Buyers who wish to go for a machine that is based on Linux often show interest in Chromebooks due to the form factor and extended battery life capabilities. Although ChromeOS power these machines, users can still miss out on a more genuine Linux experience. For those who happen to agree, the new Lemur Pro by System76 might get some heads turning.
Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.

The 10 Best Free and Open-Source CAD Software

Making its way into the world somewhere in the 1960s, Computer-Aided Design, or better known as CAD, has thoroughly revolutionized design and drawing, constituting a multi-billion market in the US alone. Today, this technology is extensively utilized in engineering-based manufacturing industries and design creations. Products are bought, sold, and traded in millions of Dollars, and this is how CAD flourishes in sectors.

Best Laptops for Linux and Apps Development [2020]

Apart from your programming skills, there are a few other things that can also influence the way you code, and one of them is your computer system for sure. Even though it isn't like you can't code on a regular PC or laptop, speaking from personal experience, you can make the most out of your programming skillset by going for a computer with high specs and one that's been specially designed for such tasks.

How to dual-boot Ubuntu and Fedora on your PC

Every Linux distribution has its capabilities and preferences as per the user requirements. That brings forth the need to run different distros on one laptop. For example, a CyberSecurity enthusiast might prefer to use Ubuntu for development and Kali Linux for penetration testing.

5 ways to check if a Port is open on a remote Linux PC

There is an ample number of ways to check for any open ports on a remote Linux PC. Knowing open ports on a Linux machine helps system administrators to connect to the remote PC for troubleshooting system and cloud server issues.