This tool can be used for converting the format of the file, adding effects, cropping, and resizing the image. If you are looking for the installation process, and steps to use ImageMagick on Linux Mint 21 read this guide.
How to Crop an Image from the Command Line on Linux Mint 21
If you want to crop the image to remove the blank space then install ImageMagick. It contains a set of command line tools to convert images. First, install the ImageMagick through the apt command:
After installing this command line tool, identify the size of the image you want to crop using the identify command, it will give the dimensions of the respective image and for it below is the syntax:
For example:
For displaying the selected image, you can use the display command with the name of the image and format:
Next, determine the following two aspects of the image:
- The position at which the image crop will start
- The size of cropped rectangle
After determining, use convert with crop option for trimming the image and converting it into a desired size, below is the syntax for the crop command one can follow:
Here, I am cropping the image from the top left more specifically x=10 and y=5 and I have set the size of the image as 250*120:
The separate file with the cropped edition in the name will be saved in the directory. Use the identify command to verify the size of the cropped image:
You can also use the display command to display your cropped image:
How to Remove ImageMagick from Linux Mint 21
If you no longer need this tool, follow the below command to completely uninstall it from your Linux system:
Bottom Line
The ImageMagick is a versatile command line tool that can be used for cropping images in a variety of ways by specifying the custom crop region. This tool is efficient and comes with many options to edit images through command line on Linux. It can convert 200 types of image formats using the command line. It also supports animation, color management, and Rendering. Install this tool from the default repository and to crop any image on Linux Mint 21.