ImageMagick
ImageMagick uses an ASCII string known as magick (e.g. GIF) to identify file formats, algorithms acting as formats, built-in patterns, and embedded profile types. Support for some of the formats are delegated to libraries or external programs. The Installation Guide describes where to find these distributions and any special configuration options required.
To get a complete listing of which image formats are supported on your system, type
On some platforms, ImageMagick automagically processes these extensions: .gz for Zip compression, .Z for Linux compression, .bz2 for block compression, and .pgp for PGP encryption. For example, a PNM image called image.pnm.gz is automagically uncompressed.
A majority of the image formats assume an sRGB colorspace (e.g. JPEG, PNG, etc.). A few support only linear RGB (e.g. EXR, DPX, CIN, HDR) or only linear GRAY (e.g. PGM). A few formats support CMYK. Then there is the occasional format that also supports LAB (that is CieLAB) (e.g. TIFF, PSD, JPG, JP2). To determine the colorspace of your image, use this command:
When processing an image, be aware of the colorspace. Many image processing algorithms assume a linear RGB colorspace. Although you may get satisfactory results processing in the sRGB colorspace, you may get improved results in linear RGB (essentially sRGB with the gamma function removed). For example,
As of IM 6.7.8-2 one can properly work in LAB colorspace whether or not Imagemagick is HDRI-enabled. Essentially the A and B channels are stored with a 50% gray bias, to allow it to handle the negatives required by the format.
Again, it may not make sense for some image processing operators to work directly in LAB space, but ImageMagick permits it and generally returns reasonable results.
ImageMagick supports reading over 100 major file formats (not including sub-formats). The following table provides a summary of the supported image formats.
ImageMagick supports a number of image format specifications which refer to images prepared via an algorithm, or input/output targets. The following table lists these pseudo-image formats:
Tag | Mode | Description | Notes |
---|---|---|---|
ASHLAR | W | Image sequence laid out in continuous irregular courses | By default, a reasonable canvas size and border width is determined relative to the image collection you provide. You can explicitly set the canvas size and border width by appending to the filename, e.g. ashlar:canvas.png[1024x768+4+4]. By default, alignment is along the left edge. Use -define ashlar:best-fit=true to align on both the left and right edges. You can label the image tiles with, for example, -label %f. By default, all image tiles are rendered on a single canvas. Use -define ashlar:tiles=50, for example, to render at most 50 tiles per canvas. |
CANVAS | R | Canvas image of specified color | Useful to create solid color canvas images. Use
-size and -depth to specify the
image width, height, and depth. Example canvas color specifications
include canvas:red and canvas:#FF0000. If no color is specified a 'white' canvas image is generated. If no -size is specified a single pixel image of the specified color is generated. |
CAPTION | R | Image caption | Use -define caption:split=true to split text if required to fit caption on the canvas |
CLIP | RW | Clip path of image | |
CLIPBOARD | RW | Clipboard | |
FRACTAL | R | Plasma fractal image | |
GRADIENT | R | Gradual passing from one shade to another | Returns a rendered linear or radial top-to-bottom gradient image using the specified image size. |
HALD | R | Identity Hald CLUT Image | Select levels like this: hald:[8] for level 8. |
HISTOGRAM | W | Histogram of the image | The histogram includes the unique colors of the image as an image comment. If you have no need for the unique color list, use -define histogram:unique-colors=false to forego this expensive operation. |
INLINE | RW | Base64-encoded inline image | The inline image look similar to inline:data:;base64,/9j/4AAQSk...knrn//2Q==. If the inline image exceeds 5000 characters, reference it from a file (e.g. inline:inline.txt). You can also write a base64-encoded image. Embed the mime type in the filename, for example, magick myimage inline:jpeg:myimage.txt. |
LABEL | R | Text image format | Specify the desired text as the filename (e.g. label:"This a label"). |
MAP | RW | Colormap intensities and indices | Set -depth to set the sample size of the intensities; indices are 16-bit if colors > 256. |
MASK | RW | Grayscale image mask. A sequence is emitted if the source image has more than one mask. | |
MATTE | W | MATTE format | Write only. |
NULL | RW | NULL image | Useful for creating blank tiles with montage (use NULL:). Also useful as an output format when evaluating image read performance. |
PANGO | R | Image caption | You can configure the caption layout with these defines: -define pango:auto-dir=true/false, -define pango:ellipsize=start/middle/end, -define pango:gravity-hint=natural/strong/line, -define pango:hinting=none/auto/full, -define pango:indent=points, -define pango:justify=true/false, -define pango:language=en_US/etc, -define pango:markup=true/false, -define pango:single-paragraph=true/false, -define pango:wrap=word/char/word-char and -define pango:align=left/center/right. |
PLASMA | R | Plasma fractal image | |
PREVIEW | W | Show a preview an image enhancement, effect, or f/x | Creates a preview montage of images prepared over a parametric range in order to assist with parameter selection. Specify the desired preview type via the -preview option). |
W | Send image to your computer printer | Linux users may set the PRINTER (for 'lpr') or LPDEST (for 'lp') environment variables to select the desired printer. | |
SCAN | R | Import image from a scanner device | Requires SANE Specify the device name and path as the filename (e.g. scan:'hpaio:/usb/Officejet_6200_series?serial=CN4ATCE3G20453'). |
RADIAL_GRADIENT | R | Gradual radial passing from one shade to another | Returns a rendered radial top-to-bottom gradient image using the specified image size. |
SCANX | R | Import image from the default scanner device | |
SCREENSHOT | R | an image that shows the contents of a computer display. Under Windows, if you have multiple monitors, it returns a screenshot for each monitor. | |
STEGANO | R | Steganographic image | Use -size command line option to specify width, height, and offset of the steganographic image |
TILE | R | Tiled image | Create a tiled version of an image at by tiling a image. Use -size to specify the tiled image size. Tiles are composited on an image background and therefore is responsive to the -compose option. The image is specified similar to TILE:image.miff. |
UNIQUE | W | Write only unique pixels to the image file. | |
VID | RW | Visual Image Directory | Used to create a thumbnailed directory (tiled thumbnails) of a set of images which may be used to select images to view via the display program, or saved to a MIFF or SHTML file. |
WIN | RW | Select image from or display image to your computer screen | Only supported under Microsoft Windows. |
X | RW | Select image from or display image to your X server screen | Also see the import and display programs. |
XC | R | Canvas image of specified color | An backward compatible alias for the 'canvas:' psuedo-file format, used to create a solid color canvas image. |
ImageMagick includes a number of built-in (embedded) images which may be referenced as if they were an image file. The magick: format tag may be used via the syntax magick:name to request an embedded image (e.g. magick:logo). For backwards compatibility, the image specifications GRANITE:, LOGO:, NETSCAPE:, and ROSE: may also be used to request images with those names.
ImageMagick includes a number of built-in (embedded) patterns which may be referenced as if they were an image file. The pattern: format tag may be used via the syntax pattern:name to request an embedded pattern (e.g. pattern:checkerboard). The pattern size is controlled with the -size command line option.
ImageMagick provides a number of format identifiers which are used to add, remove, and save embedded profiles for images which can support embedded profiles. Image types which may contain embedded profiles are TIFF, JPEG, and PDF.