File: mogrify.tex

package info (click to toggle)
imagemagick 6:6.0.6.2-2.9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 33,284 kB
  • ctags: 14,844
  • sloc: ansic: 190,790; cpp: 17,203; sh: 8,740; perl: 4,190; makefile: 1,740; tcl: 459
file content (376 lines) | stat: -rw-r--r-- 14,327 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
\title{ImageMagick - Mogrify an Image}
\toctitle{ImageMagick - Mogrify an Image}
\titlerunning{ImageMagick - Mogrify an Image}
\maketitle\label{ImageMagick - Mogrify an Image}

\section{NAME}
mogrify - mogrify an image


\section{Synopsis}

{\bf mogrify} {\bf [} {\it options\/} {\bf ... ]} {\it file ...\/}


\section{Description}

{\bf Mogrify} transforms an image or a sequence of images. These transforms
include image scaling, image rotation, color reduction, and others. Each
transmogrified image overwrites the corresponding original image, unless an
option such as
{\bf -format} causes the output filename to be different from the input
filename.

The graphics formats supported by {\bf mogrify} are listed in
{\it ImageMagick(1)\/}.


\section{Examples}

To convert all the TIFF files in a particular directory to JPEG, use:
\begin{verbatim}
    mogrify -format jpeg *.tiff
\end{verbatim}

To convert a directory full of JPEG images to thumbnails, use:
\begin{verbatim}
    mogrify -size 120x120 -resize 120x120 +profile "*" *.jpg
\end{verbatim}

In this example, {\tt '-size 120x120'} gives a hint to the JPEG decoder
that the images are going to be downscaled to 120x120, allowing it to run
faster by avoiding returning full-resolution images to ImageMagick for
the subsequent resizing operation.  The
{\tt '-resize 120x120'} specifies the desired dimensions of the
output images.  It will be scaled so its largest dimension is 120 pixels.  The
{\tt '+profile "*"'} removes any ICM, EXIF, IPTC, or other profiles
that might be present in the input and aren't needed in the thumbnails.

To scale an image of a cockatoo to exactly 640 pixels in width and 480
pixels in height, use: 
\begin{verbatim}
    mogrify -resize 640x480! cockatoo.miff
\end{verbatim}


\section{Options}

Options are processed in command line order. Any option you specify on
the command line remains in effect for the set of images that follows,
until the set is terminated by the appearance of any option or {\bf -noop}.

For a more detailed description of each option, see
{\it ImageMagick(1)\/}.


\subsubsection{-affine $<$matrix$>$}
drawing transformation matrix
\subsubsection{-antialias}
remove pixel aliasing
\subsubsection{-authenticate $<$string$>$}
decrypt image with this password
\subsubsection{-background $<$color$>$}
the background color
\subsubsection{-blue-primary $<$x$>$,$<$y$>$}
blue chromaticity primary point
\subsubsection{-blur $<$radius$>$\{x$<$sigma$>$\}}
blur the image with a Gaussian operator
\subsubsection{-border $<$width$>$x$<$height$>$}
surround the image with a border of color
\subsubsection{-bordercolor $<$color$>$}
the border color
\subsubsection{-channel $<$type$>$}
Red, Green, Blue, Opacity, Index, Cyan, Yellow, Magenta, Black, or All.

Use this option to apply an image-processing option to a particular
{\it channel\/} from the image.
\subsubsection{-charcoal $<$factor$>$}
simulate a charcoal drawing
\subsubsection{-colorize $<$value$>$}
colorize the image with the pen color
\subsubsection{-colors $<$value$>$}
preferred number of colors in the image
\subsubsection{-colorspace $<$value$>$}
the type of colorspace
\subsubsection{-comment $<$string$>$}
annotate an image with a comment
\subsubsection{-compose $<$operator$>$}
the type of image composition
\subsubsection{-compress $<$type$>$}
the type of image compression
\subsubsection{-contrast}
enhance or reduce the image contrast
\subsubsection{-convolve $<$kernel$>$}
convolve image with the specified convolution kernel
\subsubsection{-crop $<$width$>$x$<$height$>$\{+-\}$<$x$>$\{+-\}$<$y$>$\{\%\}}
preferred size and location of the cropped image
\subsubsection{-cycle $<$amount$>$}
displace image colormap by amount
\subsubsection{-debug $<$events$>$}
enable debug printout
\subsubsection{-delay $<$1/100ths of a second$>$}
display the next image after pausing
\subsubsection{-density $<$width$>$x$<$height$>$}
vertical and horizontal resolution in pixels of the image
\subsubsection{-depth $<$value$>$}
depth of the image
\subsubsection{-despeckle}
reduce the speckles within an image
\subsubsection{-display $<$host:display[.screen]$>$}
specifies the X server to contact
\subsubsection{-dispose $<$method$>$}
GIF disposal method
\subsubsection{-dither}
apply Floyd/Steinberg error diffusion to the image
\subsubsection{-draw $<$string$>$}
annotate an image with one or more graphic primitives
\subsubsection{-edge $<$radius$>$}
detect edges within an image
\subsubsection{-emboss $<$radius$>$}
emboss an image
\subsubsection{-encoding $<$type$>$}
specify the text encoding
\subsubsection{-endian $<$type$>$}
specify endianness (MSB or LSB) of output image
\subsubsection{-enhance}
apply a digital filter to enhance a noisy image
\subsubsection{-equalize}
perform histogram equalization to the image
\subsubsection{-extract $<$width$>$x$<$height$>$\{+-\}$<$x$>$\{+-\}$<$y$>$\{\%\}\{@\} \{{!}\}\{$<$\}\{$>$\}}
extract an area from the image while decoding
\subsubsection{-fill $<$color$>$}
color to use when filling a graphic primitive
\subsubsection{-filter $<$type$>$}
use this type of filter when resizing an image
\subsubsection{-flip}
create a ``mirror image''
\subsubsection{-flop}
create a ``mirror image''
\subsubsection{-font $<$name$>$}
use this font when annotating the image with text
\subsubsection{-format $<$type$>$}
the image format type
\subsubsection{-frame $<$width$>$x$<$height$>$+$<$outer bevel width$>$+$<$inner bevel width$>$}
surround the image with an ornamental border
\subsubsection{-fuzz $<$distance$>$\{\%\}}
colors within this distance are considered equal
% Utilities: ImageMagick apps=convert,mogrify
\subsubsection{-gamma $<$value$>$}
level of gamma correction
\subsubsection{-Gaussian $<$radius$>$\{x$<$sigma$>$\}}
blur the image with a Gaussian operator
\subsubsection{-geometry $<$width$>$x$<$height$>$\{+-\}$<$x$>$\{+-\}$<$y$>$\{\%\}\{@\} \{{!}\}\{$<$\}\{$>$\}}
preferred size and location of the Image window.
\subsubsection{-gravity $<$type$>$}
direction primitive  gravitates to when annotating the image.
\subsubsection{-green-primary $<$x$>$,$<$y$>$}
green chromaticity primary point
\subsubsection{-help}
print usage instructions
\subsubsection{-implode $<$factor$>$}
implode image pixels about the center
\subsubsection{-interlace $<$type$>$}
the type of interlacing scheme
\subsubsection{-label $<$name$>$}
assign a label to an image
\subsubsection{-lat $<$width$>$x$<$height$>$\{+-\}$<$offset$>$\{\%\}}
perform local adaptive thresholding
\subsubsection{-level $<$black\_point$>$\{,$<$white\_point$>$\}\{\%\}\{,$<$gamma$>$\}}
adjust the level of image contrast
\subsubsection{-limit $<$type$>$ $<$value$>$}
Disk, File, Map, or Memory resource limit
\subsubsection{-linewidth}
the line width for subsequent draw operations
\subsubsection{-list $<$type$>$}
the type of list
\subsubsection{-log $<$string$>$}
\subsubsection{-loop $<$iterations$>$}
add Netscape loop extension to your GIF animation
\subsubsection{-map $<$filename$>$}
choose a particular set of colors from this image
\subsubsection{-mask $<$filename$>$}
Specify a clipping mask
\subsubsection{-matte}
store matte channel if the image has one
\subsubsection{-mattecolor $<$color$>$}
specify the color to be used with the {\bf -frame} option
\subsubsection{-median $<$radius$>$}
apply a median filter to the image
\subsubsection{-modulate $<$value$>$}
vary the brightness, saturation, and hue of an image
\subsubsection{-monochrome}
transform the image to black and white
\subsubsection{-negate}
replace every pixel with its complementary color
\subsubsection{-noise $<$radius$|$type$>$}
add or reduce noise in an image
\subsubsection{-noop}
NOOP (no option)
\subsubsection{-normalize}
transform image to span the full range of color values
\subsubsection{-opaque $<$color$>$}
change this color to the pen color within the image
\subsubsection{-page $<$width$>$x$<$height$>$\{+-\}$<$x$>$\{+-\}$<$y$>$\{\%\}\{{!}\}\{$<$\}\{$>$\}}
size and location of an image canvas
\subsubsection{-paint $<$radius$>$}
simulate an oil painting
\subsubsection{-pen $<$color$>$}
(This option has been replaced by the -fill option)
\subsubsection{-pointsize $<$value$>$}
pointsize of the PostScript, OPTION1, or TrueType font
\subsubsection{-profile $<$filename$>$}
add ICM, IPTC, or generic profile  to image
\subsubsection{-quality $<$value$>$}
JPEG/MIFF/PNG compression level
\subsubsection{-raise $<$width$>$x$<$height$>$}
lighten or darken image edges
\subsubsection{-red-primary $<$x$>$,$<$y$>$}
red chromaticity primary point
\subsubsection{-region $<$width$>$x$<$height$>$\{+-\}$<$x$>$\{+-\}$<$y$>$}
apply options to a portion of the image
\subsubsection{-render}
render vector operations
\subsubsection{-resample $<$width$>$x$<$height$>$}
change the resolution of an image
\subsubsection{-resize $<$width$>$x$<$height$>$\{\%\}\{@\}\{{!}\}\{$<$\}\{$>$\}}
resize an image
\subsubsection{-roll \{+-\}$<$x$>$\{+-\}$<$y$>$}
roll an image vertically or horizontally
\subsubsection{-rotate $<$degrees$>$\{$<$\}\{$>$\}}
apply Paeth image rotation to the image
\subsubsection{-sample $<$geometry$>$}
scale image with pixel sampling
\subsubsection{-sampling-factor $<$horizontal\_factor$>$x$<$vertical\_factor$>$}
sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
\subsubsection{-scale $<$geometry$>$}
scale the image.
\subsubsection{-scene $<$value$>$}
set scene number
\subsubsection{-seed $<$value$>$}
pseudo-random number generator seed value
\subsubsection{-segment $<$cluster threshold$>$x$<$smoothing threshold$>$}
segment an image
\subsubsection{-shade $<$azimuth$>$x$<$elevation$>$}
shade the image using a distant light source
\subsubsection{-sharpen $<$radius$>$\{x$<$sigma$>$\}}
sharpen the image
\subsubsection{-shave $<$width$>$x$<$height$>$\{\%\}}
shave pixels from the image edges
\subsubsection{-shear $<$x degrees$>$x$<$y degrees$>$}
shear the image along the X or Y axis
\subsubsection{-size $<$width$>$x$<$height$>$\{+offset\}}
width and height of the image
\subsubsection{-solarize $<$factor$>$}
negate all pixels above the threshold level
\subsubsection{-spread $<$amount$>$}
displace image pixels by a random amount
\subsubsection{-stroke $<$color$>$}
color to use when stroking a graphic primitive
\subsubsection{-strokewidth $<$value$>$}
set the stroke width
\subsubsection{-swirl $<$degrees$>$}
swirl image pixels about the center
\subsubsection{-texture $<$filename$>$}
name of texture to tile onto the image background
\subsubsection{-threshold $<$value$>$\{$<$green$>$,$<$blue$>$,$<$opacity$>$\}\{\%\}}
threshold the image
\subsubsection{-tile $<$filename$>$}
tile image when filling a graphic primitive
\subsubsection{-tint $<$value$>$}
tint the image with the fill color.

Tint applies a color vector to each pixel in the image.
The length of the vector is 0 for black and white and at its maximum
for the midtones. The vector weighting function in between is
f(x) = (1-(4.0*((x-0.5)*(x-0.5)))). The dynamic weighting can be
controlled by a constant percentage (0..100) given as a value to
tint.
\subsubsection{-transform}
transform the image
\subsubsection{-transparent $<$color$>$}
make this color transparent within the image
\subsubsection{-treedepth $<$value$>$}
tree depth for the color reduction algorithm
\subsubsection{-trim}
trim an image
\subsubsection{-type $<$type$>$}
the image type
\subsubsection{-units $<$type$>$}
the type of image resolution
\subsubsection{-unsharp $<$radius$>$\{x$<$sigma$>$\}\{+$<$amount$>$\}\{+$<$threshold$>$\}}
sharpen the image with an unsharp mask operator
\subsubsection{-verbose}
print detailed information about the image
\subsubsection{-version}
print ImageMagick version string
\subsubsection{-view $<$string$>$}
FlashPix viewing parameters
\subsubsection{-virtual-pixel $<$method$>$}
specify contents of ``virtual pixels''
\subsubsection{-wave $<$amplitude$>$x$<$wavelength$>$}
alter an image along a sine wave
\subsubsection{-white-point $<$x$>$,$<$y$>$}
chromaticity white point

For a more detailed description of each option, see
{\it ImageMagick(1)\/}.



\section{Image Segmentation}

Use {\bf -segment} to segment an image by analyzing the histograms of
the color components and identifying units that are homogeneous with the
fuzzy c-means technique. The scale-space filter analyzes the histograms
of the three color components of the image and identifies a set of classes.
The extents of each class is used to coarsely segment the image with thresholding.
The color associated with each class is determined by the mean color of
all pixels within the extents of a particular class. Finally, any unclassified
pixels are assigned to the closest class with the fuzzy c-means technique.

The fuzzy c-Means algorithm can be summarized as follows:
{\begin{description}
\item{
Build a histogram, one for each color component of the image.}
\item{
For each histogram, successively apply the scale-space filter and build
an interval tree of zero crossings in the second derivative at each scale.
Analyze this scale-space ``fingerprint'' to determine which peaks or valleys
in the histogram are most predominant.}
\item{
The fingerprint defines intervals on the axis of the histogram. Each interval
contains either a minima or a maxima in the original signal. If each color
component lies within the maxima interval, that pixel is considered ``classified''
and is assigned an unique class number.}
\item{
Any pixel that fails to be classified in the above thresholding pass is
classified using the fuzzy c-Means technique. It is assigned to one of
the classes discovered in the histogram analysis phase.}
\end{description}}

The fuzzy c-Means technique attempts to cluster a pixel by finding the
local minima of the generalized within group sum of squared error objective
function. A pixel is assigned to the closest class of which the fuzzy membership
has a maximum value.

For additional information see:
{\it Young Won Lim, Sang Uk Lee\/}, ``{\bf On The Color Image Segmentation
Algorithm Based on the Thresholding and the Fuzzy c-Means Techniques}'',
Pattern Recognition, Volume 23, Number 9, pages 935-952, 1990.


\section{Environment}
\subsubsection{DISPLAY}
To get the default host, display number, and screen.



\section{Authors}

{\it 
John Cristy, ImageMagick Studio LLC,\newline{}
Glenn Randers-Pehrson, ImageMagick Studio LLC.
\/}