snibgo wrote:Historically, (a) mogrify could only update images, rather than making new copies and (b) it had only a subset of "convert" options (missing: auto-level, auto-gamma, black-threshold, level, threshold, ...). However, "convert" works on only one file at a time, so I use it within loops.
Almost but not quite true...
Morgrify is designed to update existing images (as you said). The image is read in modified, then written out to the same image (that makes it DANGERIOUS). It can however save to a file with a different file format (
-format option - different to that of convert) or to the same filename in a different directory.
Yes it is also limited to a sub-set of convert operators, specifically only to operators that are designed to work on each image in individually. As such things like
-border and
-crop (not tile crop)
-distort works, but
-composite and
-fx does not.
It also means multiple images can not be worked on (though you can still overlay (compose) a second image over or under another by using
-draw.
See Mogrify Summary
http://www.imagemagick.org/Usage/basics/#mogrify
Convert uses the exact same operations as mogrify (it truely does, using the same code!) but also allos the use of all the other operators that work on image lists as a whole. That is operators like
-composite,
-fx,
-flatten, which destroys and replaces the image list with the resulting merged image. also the use of parenthesis and list ordering operators like
-clone.
Where you are
wrong however is that convert is designed to only handle ONE IMAGE.
It can deal with multiple images. It can read in as many images as you like, and you and use the
-write operator to write out as many images as you like to any file name or format, or even into an internal image register (known as
MPC: which you can later read from).
For example in stead of
convert rose: -flip rose_flip.gif
convert granite: -negate dark_granite.gif
you could do this in one command...
Code: Select all
convert rose: -flip -write rose_flip.gif +delete \
granite: -negate dark_granite.gif
Note the use of
+delete to remove the image after writing it to a file.
IM provides lots of filetypes to read/save to beyond the normal 'image file formats'. from 'internal' MPC: to opening 'display' windows, already running 'X' windows (like a Xterminal window), and even different file descriptors (for advanced shell scripting pipelines).
Even I am still learning them for example I was finally able to demonstrate
InLine: images. that is encoding small images so the image itself can be read from the command line rather than an external file or piepline