What is mogrify Linux command?
mogrify is a powerful command-line tool in Linux used for batch processing images. It allows users to resize, rotate, flip, convert, and apply various effects to multiple images at once, making it a handy tool for image manipulation tasks.
mogrify Syntax:
mogrify Options:
Option | Description |
---|---|
-crop | crop an image to the specified geometry |
-resize | resize the image |
-rotate | rotate the image by the specified degrees |
-flip | flip the image vertically |
-flop | flop the image horizontally |
-quality | set the image quality |
Parameters:
Parameter | Description |
---|---|
file(s) | The image file(s) to be processed |
mogrify Command Usage Examples:
Resize Images to a Specific Width
Resizes the input_image.jpg to have a width of 800 pixels while maintaining the aspect ratio.
Convert PNG Images to JPEG Format
Converts all PNG images in the current directory to JPEG format.
Add Border to Images
Adds a black border of 20 pixels around all JPEG images in the current directory.
Rotate Images
Rotates all JPEG images in the current directory by 90 degrees clockwise.
Convert Images to Grayscale
Converts all JPEG images in the current directory to grayscale color mode.
How do I resize an image using mogrify in Linux?
To resize an image using mogrify in bash, execute the following command:
How can I rotate an image with mogrify in Linux?
To rotate an image using the mogrify command in bash, you can use the following command:
How do I convert images to grayscale with mogrify in Linux?
To convert images to grayscale with mogrify in bash, you can run the following command:
How can I add a border to an image using mogrify in Linux?
To add a border to an image with mogrify in bash, use the following command:
How do I crop an image using mogrify in Linux?
To crop an image with mogrify in bash, you can use the following command:
How can I blur an image with mogrify in Linux?
To blur an image using mogrify in bash, execute the following command:
How do I add text to an image using mogrify in Linux?
To add text to an image with mogrify in bash, you can use the following command:
Applications of the mogrify command
- Batch resize images
- Batch rotate images
- Batch convert image formats
- Batch add effects or filters to images
- Batch compress images