MOGRIFY(1) MOGRIFY(1)
NAME
mogrify - transform an image or sequence of images
SYNOPSIS
mogrify [ options ...] file [ [ options ...] file ...]
DESCRIPTION
Mogrify transforms an image or a sequence of images.
These transforms include image scaling, image rotation,
color reduction, and others. The transmogrified image
overwrites the original image.
EXAMPLES
To scale an image of a cockatoo to exactly 640 pixels in
width and 480 pixels in height, use:
mogrify -geometry 640x480 cockatoo.miff
To create a single colormap for a sequence of bird images,
use:
mogrify -colors 256 scenes/birds.*
OPTIONS
-border <width>x<height>fP
surround the image with a border or color. See X(1)
for details about the geometry specification.
The color of the border is obtained from the X server
and is defined as background (class Background). See
X(1) for details.
-clip <width>x<height>{+-}<x offset>{+-}<y offset>
preferred size and location of the clipped image.
See X(1) for details about the geometry specifica-
tion.
Use clipping to apply image processing options, or
transmogrify, only a particular area of an image.
-colormap filename
choose a particular set of colors from this image.
By default, color reduction chooses an optimal set of
colors that best represent the original image.
Alternatively, you can choose a particular set of
colors with this option. This is useful when you
want to create a sequence of images with one particu-
lar set of colors for each image.
The -colors or -monochrome option is required for
this option to take effect.
ImageMagick 10 October 1992 1
MOGRIFY(1) MOGRIFY(1)
-colors value
preferred number of colors in the image.
The actual number of colors in the image may be less
than your request, but never more. Note, this is a
color reduction option. Images with less unique col-
ors than specified with this option will remain
unchanged. Refer to Quantize(9) for more details.
If more than one image is specified on the command
line, a single colormap is created and saved with
each image.
Note, options -colormap, -dither, -colorspace, and
-treedepth affect the color reduction algorithm.
-colorspace value
the type of colorspace: GRAY, RGB, XYZ, YCbCr, YIQ,
or YUV.
Color reduction, by default, takes place in the RGB
color space. Empirical evidence suggests that dis-
tances in color spaces such as YUV or YIQ correspond
to perceptual color differences more closely than do
distances in RGB space. These color spaces may give
better results when color reducing an image. Refer
to Quantize(9) for more details.
The -colors or -monochrome option is required for
this option to take effect.
-compress type
the type of image compression: QEncoded or Runlength-
Encoded.
Specify +compress to store the binary image in an
uncompressed format. The default is the compression
type of the specified image file.
-density <width>x<height>
vertical and horizonal density of the image.
This option specifies an image density whose inter-
pretation changes with the type of image. The
default is 72 dots per inch in the horizonal and ver-
tical direction for Postscript. Text files default
to 80 characters in width and 60 lines in height.
Use this option to alter the default density.
-display host:display[.screen]
specifies the X server to contact; see X(1).
-dither
apply Floyd/Steinberg error diffusion to the image.
ImageMagick 10 October 1992 2
MOGRIFY(1) MOGRIFY(1)
The basic strategy of dithering is to trade intensity
resolution for spatial resolution by averaging the
intensities of several neighboring pixels. Images
which suffer from severe contouring when reducing
colors can be improved with this option.
The -colors or -monochrome option is required for
this option to take effect.
-enhance
apply a digital filter to enhance a noisy image.
-gamma value
level of gamma correction.
The same color image displayed on two different work-
stations may look different due to differences in the
display monitor. Use gamma correction to adjust for
this color difference. Reasonable values extend from
0.8 to 2.3.
-font name
This option specifies the font to be used for dis-
playing normal text. The default is fixed.
-geometry <width>x<height>
preferred size of the image window. See X(1) for
details about the geometry specification.
If the specified image size is smaller than the
actual image size, the image is first reduced to an
integral of the specified image size with an
antialias digital filter. The image is then scaled
to the exact specified image size with pixel replica-
tion. If the specified image size is greater than
the actual image size, the image is first enlarged to
an integral of the specified image size with bilinear
interpolation. The image is then scaled to the exact
specified image size with pixel replication.
-interlace type
the type of interlacing scheme: NONE, LINE, or PLANE.
This option is used to specify the type of interlac-
ing scheme for raw image formats such as RGB or YUV.
NONE means do not interlace (RGBRGBRGBRGBRGBRGB...),
LINE uses scanline interlacing
(RRR...GGG...BBB...RRR...GGG...BBB...), and PLANE
uses plane interlacing (RRRRRR...GGGGGG...BBBBBB...).
-inverse
apply color inversion to image.
The red, green, and blue intensities of an image are
ImageMagick 10 October 1992 3
MOGRIFY(1) MOGRIFY(1)
negated.
-monochrome
transform the image to black and white.
Monochrome images can benefit from error diffusion.
Use -dither with this option to diffuse the error.
-noise
reduce the noise in an image with a noise peak elimi-
nation filter.
The principal function of noise peak elimination fil-
ter is to smooth the objects within an image without
losing edge information and without creating unde-
sired structures. The central idea of the algorithm
is to replace a pixel with its next neighbor in value
within a 3 x 3 window, if this pixel has been found
to be noise. A pixel is defined as noise if and only
if this pixel is a maximum or minimum within the 3 x
3 window.
-normalize
tranform image to span the full range of color val-
ues.
This is a contrast enhancement technique.
-quality value
JPEG quality setting.
Quality is 0 (worst) to 100 (best). The default is
75.
-reflect
create a "mirror image" by reflecting the image scan-
lines.
-roll {+-}<x offset>{+-}<y offset>
roll an image vertically or horizontally. See X(1)
for details about the geometry specification.
A negative x offset rolls the image left-to-right. A
negative y offset rolls the image top-to-bottom.
-rotate degrees
apply Paeth image rotation to the image.
Empty triangles left over from rotating the image are
filled with the color defined by the pixel at loca-
tion (0,0). Refer to -border to choose a specific
color.
ImageMagick 10 October 1992 4
MOGRIFY(1) MOGRIFY(1)
-scale <width factor>x<height factor>
preferred size factors of the image.
This option behaves like -geometry except the width
and height values are relative instead of absolute.
The image size is multiplied by the width and height
factors to obtain the final image dimensions. If
only one factor is specified, both the width and
height factors assume the value.
Factors may be fractional. To increase the size of
an image, use a scale factor greater than 1.0. To
decrease an image's size, use a scale factor less
than 1.0. Default is 1.0.
-scene value
image scene number.
-shear <x degrees>x<y degrees>
shear the image along the X or Y axis by a positive
or negative shear angle.
Shearing slides one edge of an image along the X or Y
axis, creating a parallelogram. An X direction shear
slides an edge along the X axis, while a Y direction
shear slides an edge along the Y axis. The amount of
the shear is controlled by a shear angle. For X
direction shears, x degrees> is measured relative to
the Y axis, and similarly, for Y direction shears y
degrees is measured relative to the X axis.
Empty triangles left over from shearing the image are
filled with the color defined by the pixel at loca-
tion (0,0). Refer to -border to choose a specific
color.
-treedepth value
Normally, this integer value is zero or one. A zero
or one tells Mogrify to choose a optimal tree depth
for the color reduction algorithm.
An optimal depth generally allows the best represen-
tation of the source image with the fastest computa-
tional speed and the least amount of memory. How-
ever, the default depth is inappropriate for some
images. To assure the best representation, try val-
ues between 2 and 8 for this parameter. Refer to
Quantize(9) for more details.
The -colors or -monochrome option is required for
this option to take effect.
-verbose
print detailed information about the image.
ImageMagick 10 October 1992 5
MOGRIFY(1) MOGRIFY(1)
This information is printed: image scene number;
image name; image size; the image class (DirectClass
or PseudoClass); the total number of unique colors
(if known); and the number of seconds to read and
transform the image. Refer to MIFF(5) for a descrip-
tion of the image class.
If -colors is also specified, the total unique colors
in the image and color reduction error values are
printed. Refer to Quantize(9) for a description of
these values.
Any option you specify on the command line remains in
effect until it is explicitly changed by specifying the
option again with a different effect. For example, to
mogrify two images, the first with 32 colors and the sec-
ond with only 16 colors, use:
mogrify -colors 32 cockatoo.miff -colors 16
macaw.miff
Change - to + in any option above to reverse its effect.
For example, specify +compress to store the binary image
in an uncompressed format.
To specify a particular image format prefix file with the
image type and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps). See
CONVERT(1) for a list of valid image formats. If file has
the extension .Z, the file size is reduced using Lempel-
Ziv coding with compress. If file already exists, you
will be prompted as to whether it should be overwritten.
SEE ALSO
display(1), animate(1), import(1), convert(1), Quan-
tize(9), MIFF(5), X(1), compress(1)
COPYRIGHT
Copyright 1992 E. I. du Pont de Nemours & Company
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby
granted without fee, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation, and that the name of E. I. du Pont de
Nemours & Company not be used in advertising or publicity
pertaining to distribution of the software without spe-
cific, written prior permission. E. I. du Pont de Nemours
& Company makes no representations about the suitability
of this software for any purpose. It is provided "as is"
without express or implied warranty.
E. I. du Pont de Nemours & Company disclaims all
ImageMagick 10 October 1992 6
MOGRIFY(1) MOGRIFY(1)
warranties with regard to this software, including all
implied warranties of merchantability and fitness, in no
event shall E. I. du Pont de Nemours & Company be liable
for any special, indirect or consequential damages or any
damages whatsoever resulting from loss of use, data or
profits, whether in an action of contract, negligence or
other tortious action, arising out of or in connection
with the use or performance of this software.
ACKNOWLEDGEMENTS
Michael Halle, Spatial Imaging Group at MIT, for the ini-
tial implementation of Alan Paeth's image rotation algo-
rithm.
David Pensak, E. I. du Pont de Nemours & Company, for pro-
viding a computing environment that made this program pos-
sible.
Paul Raveling, USC Information Sciences Institute, for the
original idea of using space subdivision for the color
reduction algorithm.
AUTHORS
John Cristy, E.I. du Pont de Nemours & Company Incorpo-
rated
ImageMagick 10 October 1992 7