RMagick User's Guide and Reference
class Image (attribute accessors)

Table Of Contents

background_color
background_color=
image.background_color -> aString
image.background_color = aString
image.background_color = aPixel
  The image's background color expressed as a color name or a Pixel object. By default the background color is "white".
base_columns image.base_columns -> anInteger
  The number of columns in the image before any transformations.
base_filename image.base_filename -> aString
  The image's original filename before any transformations.
base_rows image.base_rows -> anInteger
  The number of rows in the image before any transformations.
blur
blur=
image.blur -> aFloat
image.blur = aFloat
  The blur factor to use when resizing. See resize.
border_color
border_color=
image.border_color -> aString
image.border_color = aString
image.border_color = aPixel
  The image's border color expressed as a color name or a Pixel object. The default border color is "#dfdfdf" (gray).
bounding_box image.bounding_box -> aRectangle
 
The image's bounding box. The bounding box is the rectangle that encloses all the pixels not in the border color. In this example, the bounding box is the gray square enclosing the blue circle. (The coordinates and red circles were added after the bounding box was computed.)

The return value is a rectangle.

ex/bounding_box.rb
chromaticity
chromaticity=
image.chromaticity -> aChromaticity
image.chromaticity = aChromaticity
  The red, green, blue, and white-point chromaticity values. See Chromaticity
class_type
class_type=
image.class_type -> aClassType
image.class_type = aClassType
 

The image's storage class.

If DirectClass then the pixels contain valid RGB or CMYK colors. If PseudoClass then the image has a colormap referenced by the pixel's index member.

See ClassType.

clip_mask= image.clip_mask = anImage
image.clip_mask = anImage
image.clip_mask = nil
  Associates a clip mask with the image. The clip mask must have the same dimensions as the image. Set any pixel component of the clip mask to TransparentOpacity to prevent that corresponding image pixel component from being updated. If the assigned object is an imagelist, uses the current image as the clip mask.

Assign nil to remove the clip mask.

color_profile
color_profile=
image.color_profile -> aString
image.color_profile = aString
  The ICC color profile.
colors image.colors -> anInteger
  The number of colors in the colormap. Only meaningful for PseudoClass images.
colorspace
colorspace=
image.colorspace -> aColorspace
image.colorspace = aColorspace
 
Image pixel interpretation. If the colorspace is RGBColorspace the pixels are red, green, blue. If matte is true, then red, green, blue, and opacity. If it is CMYKColorspace, the pixels are cyan, yellow, magenta, black. Otherwise the colorspace is ignored.
columns image.columns -> anInteger
  The width of the image.
compose
compose=
image.compose -> aCompositeOperator
image.compose = aCompositeOperator
  Image composite operator. The default is OverCompositeOp.
compression
compression=
image.compression -> aCompressionType
image.compression = aCompressionType
 
Image compression type. The default is the compression type of the specified image file.
delay
delay=
image.delay -> anInteger
image.delay = anInteger
 
Time in 1/100ths of a second (0 to 65535) which must expire before displaying the next image in an animated sequence.

The default is 0.

density
density=
image.density -> aString
image.density = aString
  The vertical and horizontal resolution in pixels of the image. The density is a string in the form "XxY", or simply "X". If "Y" is omitted it is set to "X". The default is "72x72".

Also see x_resolution and y_resolution.

depth image.depth -> anInteger
  The image depth (8 or 16).
directory image.directory -> aString
 
Tile names from within an image montage. Only valid after calling Image#montage or reading a MIFF file which contains a directory.
dispose
dispose=
image.dispose -> anInteger
image.dispose = aDisposeType
 
GIF disposal method. This attribute is used to control how successive images are rendered (how the preceding image is disposed of) when creating a GIF animation.
extract_info (5.5.6)
extract_info=
image.extract_info -> aRectangle
image.extract_info = aRectangle
 

Specify a rectangle within an image, or retrieve the rectangle specified when the image was constituted. See Image::Info#extract=.

Note: with releases of ImageMagick prior to 5.5.6, this attribute is a synonym for tile_info.

filename image.filename -> aString
  The image filename.
filesize image.filesize -> anInteger
  The image filesize in bytes.
filter
filter=
image.filter -> aFilterType
image.filter = aFilterType
 
Filter to use when resizing image. The reduction filter employed has a significant effect on the time required to resize an image and the resulting quality. The default filter is Lanczos which has been shown to produce high quality results when reducing most images.
format
format=
image.format -> aString
image.format = aString
  The encoding format. For example, "GIF" or "PNG".
fuzz
fuzz=
image.fuzz -> aFloat
image.fuzz = aFloat
 
Colors within this distance are considered equal. A number of algorithms search for a target color. By default the color must be exact. Use this option to match colors that are close to the target color in RGB space.

See the opaque, texture_floodfill, and transparent methods.

gamma
gamma=
image.gamma -> aFloat
image.gamma = aFloat
 
Gamma level of the image. The same color image displayed on two different workstations may look different due to differences in the display monitor. Use gamma correction to adjust for this color difference.
geometry
geometry=
image.geometry -> aString
image.geometry = aString
 
Preferred size of the image when encoding.
See The geometry string.
image_type
image_type=
image.image_type -> anImageType
image.image_type = anImageType
  The image type classification. For example, GrayscaleType. Don't confuse this attribute with the format, that is "GIF" or "JPG".
interlace
interlace=
image.interlace -> anInterlaceType
image.interlace = anInterlaceType
 
The type of interlacing scheme (default NoInterlace). This option is used to specify 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.

See InterlaceType.

iptc_profile
iptc_profile=
image.iptc_profile -> aString
image.iptc_profile = aString
image.iptc_profile = nil
 
IPTC profile. Specifications are available from the International Press Telecommunications Council for IPTC profiles.

To remove an existing profile, assign nil to the iptc_profile attribute.

matte
matte=
image.matte -> true or false
image.matte = true or false
  If true, honor the opacity values in the image pixels. See Pixel.
matte_color
matte_color=
image.matte_color -> aString
image.matte_color = aString
image.matte_color = aPixel
  The matte color. Specify a color name or a Pixel object. By default, "#bdbdbd".
mean_error_per_pixel image.mean_error_per_pixel -> aFloat
 
The mean error per pixel computed when a image is color reduced. This parameter is only valid if the verbose argument to quantize or Image#quantize is set to true.
mime_type
image.mime_type -> aString
 
Returns the officially registered (or de facto) MIME media-type.
If there is no registered media-type, returns "image/x-magick".
montage
montage=
image.montage -> aString
image.montage = aString
 
Tile size and offset within an image montage. Only valid for montage images. The string is in the form of a geometry string.

See ImageList#montage.

normalized_mean_error image.normalized_mean_error -> aFloat
 
The normalized mean error per pixel computed when an image is color reduced. This parameter is only valid if the verbose argument to quantize or Image#quantize is set to true.
normalized_maximum_error image.normalized_maximum_error -> aFloat
 
The normalized mean error per pixel computed when an image is color reduced. This parameter is only valid if the verbose argument to quantize or Image#quantize is set to true.
number_colors image.number_colors -> anInteger
  Number of unique colors in the image.
offset
offset=
image.offset -> anInteger
image.offset = anInteger
 
Number of initial bytes to skip over when reading raw image.
opacity= image.opacity = anInteger
  A number between 0 and MaxRGB. Attenuates the opacity channel of an image. If the image pixels are opaque, they are set to the specified opacity level. Otherwise, the pixel opacity values are blended with the supplied transparency value.

Note: there is no equivalent reader method.

page
page=
image.page -> aRectangle
image.page = aRectangle
  When compositing, this attribute describes the position of this image with respect to the underlying image. See ImageList#coalesce, ImageList#flatten_images, and ImageList#mosaic.

See Rectangle.

rendering_intent
rendering_intent=
image.rendering_intent -> aRenderingIntent
image.rendering_intent = aRenderingIntent
 
The type of rendering intent.

See RenderingIntent.

rows image.rows -> anInteger
  The height of the image.
scene image.scene -> anInteger
  The scene number assigned to the image the last time the image was written to a multi-image image file. Don't confuse this attribute with the ImageList#scene attribute, which denotes the image to which Image methods will be sent.
start_loop
start_loop=
image.start_loop -> true or false
image.start_loop = true or false
  Indicates the first image in an animation.
tile_info
tile_info=
image.tile_info -> aRectangle
image.tile_info = aRectangle
 
Describes a tile within an image.  For example, if your image is 640x480 you may only want 320x256 with an offset of +128+64. It is used for raw formats such as RGB and CMYK as well as for TIFF.

Note: This attribute is deprecated in ImageMagick 5.5.6 and later. Use extract_info instead.

See Rectangle.

total_colors image.total_colors -> anInteger
  Set by quantize and Image#quantize, if the verbose argument is true. The number of colors in the image.
units
units=
image.units -> aResolutionType
image.units = aResolutionType
  Units of image resolution. See ResolutionType.
x_resolution
x_resolution=
image.x_resolution -> aFloat
image.x_resolution = aFloat
  Horizontal resolution of the image.
y_resolution
y_resolution=
image.y_resolution -> aFloat
image.y_resolution = aFloat
  Vertical resolution of the image.