![]() |
![]() |
![]() |
|
This document describes how ImageMagick performs color reduction on an image. To fully understand this document, you should have a knowledge of basic imaging techniques and the tree data structure and terminology.
For purposes of color allocation, an image is a set of n pixels, where each pixel is a point in RGB$imagelob=>$blob); This is a more efficient and less memory intensive way to query if an image exists and what its characteristics are. PreviewImage() tiles 9 thumbnails of the specified image with an image processing operation applied at varying strengths. This may be helpful pin-pointing an appropriate parameter for a particular image processing operation. Choose from these operations: Rotate, Shear, Roll, Hue, Saturation, Brightness, Gamma, Spiff, Dull, Grayscale, Quantize, Despeckle, ReduceNoise, AddNoise, Sharpen, Blur, Threshold, EdgeDetect, Spread, Solarize, Shade, Raise, Segment, Swirl, Implode, Wave, OilPaint, CharcoalDrawing, JPEG. Here is an example:
$preview = $image->Preview('Gamma');
$preview->Display();
To have full control over text positioning you need font metric information. Use
($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) =
Where parameters is any parameter of the
Annotate method. The return values are:
Call QueryColor() with no parameters to return a list of known colors names or specify one or more color names to get these attributes: red, green, blue, and opacity value.
@colors = $image->QueryColor();
QueryColorname() accepts a color value and returns its respective name or hex value;
$name = $image->QueryColorname('rgba(80,60,0,0)');
Call QueryFont() with no parameters to return a list of known fonts or specify one or more font names to get these attributes: font name, description, family, style, stretch, weight, encoding, foundry, format, metrics, and glyphs values.
@fonts = $image->QueryFont();
Call QueryFormat() with no parameters to return a list of known image formats or specify one or more format names to get these attributes: adjoin, blob support, raw, decoder, encoder, description, and module.
@formats = $image->QueryFormat();
($adjoin, $blob_support, $raw, $decoder, $encoder,
$description, $module) = $image->QueryFormat('gif');
Call MagickToMime() with the image format name to get its MIME type such as image/tiff from tif.
$mime = $image->MagickToMime('tif');
Use RemoteCommand() to send a command to an already running display or animate application. The only parameter is the name of the image file to display or animate. Finally, the Transform() method accepts a fully-qualified geometry specification for cropping or resizing one or more images. For example,
$p = $image->Transform(crop=>'100x100');
You can optionally add Image to any method name above. For
example, PingImage() is an alias for method Ping(). |
|
|
|
All PerlMagick methods return an undefined string context upon success. If any problems occur, the error is returned as a string with an embedded numeric status code. A status code less than 400 is a warning. This means that the operation did not complete but was recoverable to some degree. A numeric code greater or equal to 400 is an error and indicates the operation failed completely. Here is how errors are returned for the different methods:
Error 400: Memory allocation failed
Below is a list of error and warning codes:
The following illustrates how you can use a numeric status code:
$x = $image->Read('rose.png');
|