par

Easily resize an image in one command line

I’m not a command line expert, but I’m so tired of spending entire minutes trying to figure out how to resize an image before uploading it somewhere that I was willing to learn this one command line trick.

Prerequisites

  • This command is based on ImageMagick, which was preinstalled on my Linux Mint computer and might need to be installed on other systems.
  • You need to know how to open terminal.
  • You need to know how to navigate files and get the path of a file. (This can be done in terminal, or by right-clicking an image and copying its path.)

Steps

Grab the image’s path. Make a copy if you want to keep the original.

Open your terminal.

Type:

mogrify -resize widthxheight pathwithextension.jpg

This will replace your old image with the resized one.

Examples

Resize an image to 300×200:

mogrify -resize 300x200 thisimage.png

Resize an image to a width of 1920, keeping height proportional:

mogrify -resize 1920 thisimage.jpg
❤️

Commentaire / Comment

Commenter