Some Image
and ImageList
methods,
such as read
and write
, accept an
"optional arguments" block in which you can set attributes that
modify the method's output. These attributes belong to the
Image::Info
class. The Image::Info
class exists only to accept optional arguments for those Image
and ImageList methods.
This page explains the methods defined in the
Image::Info
class. Generally, each
Image
or ImageList
method that uses
the Image::Info
class to get optional arguments
will only accept some of the attributes listed on this page,
that is, only those attributes that are meaningful for the
particular method. Any other attributes that you set are
ignored. Also, some attributes are only used by a subset of the
image formats. See the ImageMagick documentation for more
information.
Remember, you do not ever need to create an
Image::Info
object. The object is created for you
before the optional arguments block is entered and destroyed
after the block is exited.
All the attributes in the Image::Info class are read/write. For simplicity, and because usually you only set these attributes, just the setter version of each attribute method is described.
self.define(format, key[, value])
define
method is a new, general-purpose way of
specifying options that apply to specific image formats. This
method is available in ImageMagick 6.0.0 and GraphicsMagick
1.1.
self
See the ×Magick documentation for the -define utility command option for a list of valid formats, keys, and values.
self.define("tiff", "bits-per-sample", 2)
SetImageOption (ImageMagick 6.0.0), AddDefinitions (GraphicsMagick 1.1)
self.antialias= true
or false
Control antialiasing of rendered
Postscript and Postscript or TrueType fonts. The default
is true
.
self.background_color= aPixel or aPixel
Set the image background color. The default is "white".
A color name or a aPixel.
self.border_color= aString or aPixel
Set the image border color. The default is "#dfdfdf".
A color name or a aPixel.
self.colorspace= aColorspaceType
self.compression= aCompressionType
Specify the image compression type. Not all compression types are supported for all image formats. If you specify an unsupported compression type, the default compression type is used instead.
self.density= aString or aGeometry
Specify the vertical and horizontal resolution in pixels. The default density is "72.0x72.0".
The argument can be either a string in the form "XxY" where
"X" is the horizontal resolution and "Y" is the vertical
resolution, or a Geometry
object where width
is the horizontal resolution
and height
is the vertical resolution.
self.depth= aNumber
Specify the image depth.
Either 8, 16, or 32. You can specify 16 and 32 only when ×Magick was compiled with a QuantumDepth that allows these depth values.
self.dither= true
or false
Apply Floyd/Steinberg error diffusion to the image. 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.
self.extract= aString or aGeometry
Specify a portion of an image to be extracted when the image is constituted. This attribute can be used to identify a subset of an image that is otherwise too large to keep in memory.
Either a geometry string or a Geometry object. For example:
self.extract = "200x200+100+100"
.
This attribute replaces the tile attribute, which is deprecated in ImageMagick 5.5.6 and later.
self.filename= aString
See capture.
self.font= aString
Set the text rendering font.
self.format= aString
self.fuzz= aNumeric or aString
Set the level of "fuzziness" for comparing pixels. By
default the pixels must be identical to be considered equal.
The larger the fuzz
value the more difference is
tolerated.See fuzz.
The argument may be a numeric value or a string in the form
"NN%". In the second case, the argument is computed as a
percentage of MaxRGB. For
example, a value of '5%' sets fuzz
to
0.05*MaxRGB.
self.image_type= anImageType
The image type classification. For example, GrayscaleType. Don't confuse this attribute with the format such as "GIF" or "JPG".
An ImageType constant.
self.interlace= anInterlaceType
[S]pecify the type of interlacing scheme for raw image formats such as RGB or YUV. NoInterlace means do not interlace, LineInterlace uses scanline interlacing, and PlaneInterlace uses plane interlacing. PartitionInterlace is like PlaneInterlace except the different planes are saved to individual files (e.g. image.R, image.G, and image.B). Use LineInterlace or PlaneInterlace to create an interlaced GIF or progressive JPEG image. The default is NoInterlace.
self.matte_color= aString or aPixel
Set the image transparent color. The default is "#bdbdbd".
A color name or a aPixel.
self.monochrome= true
or false
Transform the image to black and white on input. Only the ETP, PDF, and PS formats respect this attribute.
self.number_scenes= anInteger
Used in conjunction with scene to specify the range of frames to be extracted when constituting a multi-frame image.
This attribute replaces the subrange
attribute, which is deprecated in ImageMagick 5.5.6 and later.
If number_scenes
is used with a version of
ImageMagick prior to 5.5.6, it is a synonym for the
subrange
attribute.
self.page= aString or aGeometry
Set the equivalent size of the Postscript page. The default is "612x792>".
A geometry string or a Geometry object.
self.quality= anInteger
Set the compression level to use when writing JPEG, MIFF, and PNG images. The default is 75.
self.scene= anInteger
Used in conjunction with number_scenes to specify the range of frames to be extracted when constituting a multi-frame image.
This attribute replaces the subimage
attribute, which is deprecated in ImageMagick 5.5.6 and later.
If scene
is used with a version of ImageMagick
prior to 5.5.6, it is a synonym for the subimage
attribute.
self.server_name= aString
Set the X11 display to obtain fonts from.
self.size= aString or aGeometry
Set the width and height of the image when reading a built-in image format that does not have an inherent size, or when reading an image from a multi-resolution file format such as Photo CD, JBIG, or JPEG.
A geometry string or a Geometry object.
self.subimage= anInteger
Specify a base image of an image sequence in a multi-frame image.
This attribute is deprecated in ImageMagick 5.5.6 and later. Use the scene attribute instead.
self.subrange= anInteger
Specify the number of images relative to the base image. See subimage.
This attribute is deprecated in ImageMagick 5.5.6 and later. Use the number_scenes attribute instead.
self.tile= aString or aGeometry
Specify a portion of an image to be extracted when the image
is constituted. The argument is a geometry string. For example:
self.tile = "200x200+100+100"
. This attribute can
be used to identify a subset of an image that is otherwise too
large to keep in memory.
A geometry string or a Geometry object.
This attribute is deprecated in ImageMagick 5.5.6 and later. Use the extract attribute instead.
self.units= aResolutionType
self.view= aString
FlashPix viewing parameters.