mogrify
Modify images in place (batch processing)
TLDR
View documentation for the original command
SYNOPSIS
mogrify [options] file...
PARAMETERS
-adaptive-blur geometry
Adaptively blur the image.
-adaptive-resize geometry
Adaptively resize the image with data dependent triangulation.
-adaptive-sharpen geometry
Adaptively sharpen the image.
-alpha option
Set the alpha channel option (e.g., 'set', 'off', 'remove').
-antialias
Turn on/off antialiasing.
-background color
Set the background color.
-blur geometry
Reduce image noise and reduce detail levels.
-bordercolor color
Set the border color.
-border geometry
Add a border to the image.
-colors value
Preferred number of colors in the image.
-comment string
Attach a comment to the image.
-contrast
Enhance or reduce the image contrast.
-crop geometry
Crop the image.
-despeckle
Reduce the speckle noise in an image.
-format type
Specify the output image format (e.g., 'jpg', 'png', 'gif').
-gamma value
Correct the image gamma.
-gravity type
Define which direction to extend/place the image.
-resize geometry
Resize the image.
-rotate degrees
Rotate the image by the specified number of degrees.
-sharpen geometry
Sharpen the image.
-strip
Strip all profiles and text attributes from an image.
-thumbnail geometry
Create a thumbnail of the image.
-trim
Trim edges that are the background color.
-unsharp geometry
Sharpen the image.
DESCRIPTION
The mogrify command is part of the ImageMagick suite, a powerful command-line tool for image manipulation. Mogrify reads one or more image files and applies a series of operations (specified as command-line options) directly to the original image files.
Unlike 'convert', which creates new files, mogrify overwrites the input files, making it suitable for batch processing and applying transformations to large image sets. Use this command with caution, since it modifies the original images, and backups are recommended before usage. It offers a wide range of options for resizing, rotating, color correcting, applying filters, and more. It allows you to easily perform complex image processing tasks from the command line. It’s especially useful when dealing with a large number of images where manual editing would be impractical.
CAVEATS
Mogrify overwrites the original image files. It's crucial to create backups before using this command to avoid data loss. Incorrect usage can lead to irreversible changes in your image data.
GEOMETRY SPECIFICATION
The geometry argument used in options like -resize, -crop, etc., follows a standard format: '[width]x[height][+xoff+yoff][%][@]'. Width and height are dimensions, xoff and yoff are offsets, % represents percentage scaling, and @ indicates the area is in megabytes.
FILE FORMAT CONSIDERATION
When using '-format', be aware of compression and feature support of each file format. Converting a JPEG to a PNG will likely result in a larger file size, while converting a PNG to a JPEG may introduce compression artifacts. Also, convert from formats which support animation/layers (like GIF and TIFF) to JPG is destructive.
HISTORY
Mogrify has been a core part of the ImageMagick suite since its early development.
ImageMagick was first released in 1990 and has evolved over the years to become a robust and versatile image processing tool. Mogrify's functionality, specifically in-place modification, was a key feature early on, allowing for efficient batch processing where creating copies was unnecessary.