|
[Example Usage | Option Summary]
Use the mogrify program to resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more. This tool is similiar to convert except the original image file is overwritten with any changes you request. See Command Line Processing for advice on how to structure your mogrify command or see below for example usages of the command.
We list a few examples of the mogrify command here to illustrate its usefulness and ease of use. To get started, lets reduce the size of our
rose:
mogrify -resize 50% rose.jpg
You can resize all your JPEG images in a folder to a maximum dimension of 256x256 with this command:
mogrify -resize 256x256 *.jpg
Finally, we convert all our PNG images to the JPEG format:
mogrify -format jpg *.png
Here image files 1.png, 2.png, etc., are left untouched and files 1.jpg, 2.jpg, etc., are created. They are copies of their respective PNG images except are stored in the JPEG image format.
You can find additional examples of using mogrify in Graphics from the Command Line. Further discussion is available in More Graphics from the Command Line and Examples of ImageMagick Usage.
The mogrify command recognizes these options. Click on an option to get more details about how that option works.
| Option |
Description |
| -adjoin |
join images into a single multi-image file |
| -affine matrix |
affine transform matrix |
| -annotate geometry text |
annotate the image with text |
| -antialias |
remove pixel-aliasing |
| -append |
append an image sequence |
| -authenticate value |
decrypt image with this pops before stopping.
label = { string }
defines a short title or caption for the image. If any whitespace appears in the label, it must be enclosed within braces.
matte = True
matte = False
specifies whether a the image has matte data. Matte data is generally useful for image compositing.
montage = <width>x<height>{+-}<x offset>{+-}<y offset>
size and location of the individual tiles of a composite image.
Use this key when the image is a composite of a number of different tiles. A tile consists of an image and optionally a border and a label. Width is the size in pixels of each individual tile in the horizontal direction and height is the size in the vertical direction. Each tile must have an equal number of pixels in width and equal in height. However, the width can differ from the height. X offset is the offset in number of pixels from the vertical edge of the composite image where the first tile of a row begins and y offset is the offset from the horizontal edge where the first tile of a column begins.
If this key is specified, a directory of tile names must follow the image header. The format of the directory is explained below.
page = value
preferred size and location of an image canvas.
profile-icc = value
the number of bytes in the International Color Consortium color profile. The profile is defined by the ICC profile specification located at ftp://sgigate.sgi.com/pub/icc/icc34.ps.
red-primary = x,y
green-primary = x,y
blue-primary = x,y
white-point = x,y
this optional key reflects the chromaticity primaries and white point.
rendering-intent = saturation
rendering-intent = perceptual
rendering-intent = absolute
rendering-intent = relative
Rendering intent is the CSS-1 property that has been defined by the International Color Consortium (http://www.color.org).
resolution = <x-resolution>x<y-resolution>
vertical and horizontal resolution of the image. See units for the specific resolution units (e.g. pixels per inch).
rows = value
the height of the image in pixels. This is a required key and has no default value.
scene = value
the sequence number for this MIFF image file. This optional key is useful when a MIFF image file is one in a sequence of files used in an animation.
signature = value
this optional key contains a string that uniquely identifies the image pixel contents. NIST's SHA-256 message digest algorithm is recommended.
units = pixels-per-inch
units = pixels-per-centimeter
image resolution units.
Other key value pairs are permitted. If a value contains whitespace it must be enclosed with braces as illustrated here:
id=ImageMagick
classseudoClass colors=256
compression=RunlengthEncoded packets=27601
columns=1280 rows=1024
signature=d79e1c308aa5bbcdeea8ed63df412da9
copyright={Copyright (c) 1999-2005 ImageMagick Studio LLC}
:
Note that key = value combinations may be separated by newlines or spaces and may occur in any order within the header. Comments (within braces) may appear anywhere before the colon.
If you specify the montage key in the header, follow the header with a directory of image tiles. This directory consists of a name for each tile of the composite image separated by a newline character. The list is terminated with a NULL character.
If you specify the color-profile key in the header, follow the header (or montage directory if the montage key is in the header) with the binary color profile.
The header is separated from the image data by a : character immediately followed by a newline.
Next comes the binary image data itself. How the image data is formatted depends upon the class of the image as specified (or not specified) by the value of the class key in the header.
DirectClass images are continuous-tone, images stored as RGB (red, green, blue), RGBA (red, green, blue, alpha), CMYK (cyan, yellow, magenta, black), or CMYKA (cyan, yellow, magenta, black, alpha) intensity values as defined by the colorspace key. Each intensity value is one byte in length for images of depth 8 (0..255), two bytes for a depth of 16 (0..65535), and images of depth 32 (0..4294967295) require four bytes in most significant byte first order.
PseudoClass images are colormapped RGB images. The colormap is stored as a series of red, green, and blue pixel values, each value being a byte in size. If the image depth is 16, each colormap entry consumes two bytes with the most significant byte being first. The number of colormap entries is defined by the colors key. The colormap data occurs immediately following the header (or image directory if the montage key is in the header). PseudoClass image data is an array of index values into the color map. If there are 256
or fewer colors in the image, each byte of image data contains an index value. If the image contains more than 256 colors or the image depth is 16, the index value is stored as two contiguous bytes with the most significant byte being first. If matte is true, each colormap index is followed by a 1 or 2-byte alpha value.
The image pixel data in a MIFF file may be uncompressed, runlength encoded, Zip compressed, or BZip compressed. The compression key in the header defines how the image data is compressed. Uncompressed pixels are stored one scanline at a time in row order. Runlength-encoded compression counts runs of identical adjacent pixels and stores the pixels followed by a length byte (the number of identical pixels minus 1). Zip and BZip compression compresses each row of an image and precedes the compressed row with the length of compressed pixel bytes as a word in most significant byte first order.
MIFF files may contain more than one image. Simply concatenate each individual image (composed of a header and image data) into one file.
|
|
|