RMagick User's Guide and Reference
Constants

All RMagick constants are defined in the Magick module.

Table of contents

Miscellaneous constants
MagickVersion The ×Magick version string. This has the form:
@(#)ImageMagick X.Y.Z MM/DD/YY Q:16 http://www.imagemagick.org
or
GraphicsMagick 1.0 05/05/03 Q8 http://www.GraphicsMagick.org/
MaxRGB The maximum value of a Quantum . A quantum is one of the red, green, blue, or opacity elements of a pixel in the RGB colorspace, or cyan, yellow, magenta, or black elements in the CYMK colorspace. If ×Magick is built using -DQuantumDepth=16, then MaxRGB is 65535, otherwise it is 255.
QuantumDepth The number of bits in a quantum. If ×Magick is built using -DQuantumDepth=16, then QuantumDepth is 16, otherwise it is 8.
Version The RMagick version string. This has the form:
RMagick X.Y.Z
AlignType - See Draw#align=, Draw#text_align.
UndefinedAlign
LeftAlign
CenterAlign
RightAlign
ChannelType - see Image#channel
UndefinedChannel
RedChannel
GreenChannel
BlueChannel
MagentaChannel
YellowChannel
BlackChannel
OpacityChannel
ClassType - The ClassType constants specify the image storage class.

See Image#class_type

UndefinedClass Unset value
DirectClass Image is composed of pixels which represent literal color values.
PseudoClass Image is composed of pixels which specify an index in a color palette.

ColorspaceType - The ColorspaceType constants are used to specify the colorspace that quantization (color reduction and mapping) is done under or to specify the colorspace when encoding an output image. Colorspaces are ways of describing colors to fit the requirements of a particular application (e.g. Television, offset printing, color monitors).  Color reduction, by default, takes place in the RGBColorspace. Empirical evidence suggests that distances in color spaces such as YUVColorspace or YIQColorspace correspond to perceptual color differences more closely than do distances in RGB space. These color spaces may give better results when color reducing an image.

When encoding an output image, the colorspaces RGBColorspace, CMYKColorspace, and GRAYColorspace may be specified. The CMYKColorspace option is only applicable when writing TIFF, JPEG, and Adobe Photoshop bitmap (PSD) files.

See Image#colorspace

UndefinedColorspace  
RGBColorspace Red-Green-Blue colorspace
GRAYColorspace  
TransparentColorspace The Transparent color space behaves uniquely in that it preserves the matte channel of the image if it exists.
OHTAColorspace  
XYZColorspace  
YCbCrColorspace  
YIQColorspace  
YPbPrColorspace  
YUVColorspace Y-signal, U-signal, and V-signal colorspace. YUV is most widely used to encode color for use in television transmission.
CMYKColorspace Cyan-Magenta-Yellow-Black colorspace. CYMK is a subtractive color system used by printers and photographers for the rendering of colors with ink or emulsion, normally on a white surface.
SRGBColorspace In ×Magick, this constant is named sRGBColorspace
ComplianceType - see Pixel#to_color
SVGCompliance Adhere to SVG color standard.
X11Compliance Adhere to X11 color standard.
XPMCompliance Adhere to XPM color standard.
AllCompliance The union of the 3 color standards.
CompositeOperator - The CompositeOperator constants are used to select the image composition algorithm used to compose a composite image with a image. By default, each of the composite image pixels are replaced by the corresponding image tile pixel. Specify CompositeOperator to select a different algorithm.
UndefinedCompositeOp  
OverCompositeOp The result is the union of the the two image shapes with composite image obscuring image in the region of overlap.
InCompositeOp The result is simply composite image cut by the shape of image. None of the image data of image is included in the result.
OutCompositeOp The resulting image is composite image with the shape of image cut out.
AtopCompositeOp The result is the same shape as image, with composite image obscuring image where the image shapes overlap. Note that this differs from OverCompositeOp because the portion of composite image outside of image's shape does not appear in the result.
XorCompositeOp The result is the image data from both composite image and image that is outside the overlap region. The overlap region will be blank.
PlusCompositeOp The result is just the sum of the image data. Output values are cropped to 255 (no overflow). This operation is independent of the matte channels.
MinusCompositeOp The result of composite image - image, with overflow cropped to zero. The matte chanel is ignored (set to 255, full coverage).
AddCompositeOp The result of composite image + image, with overflow wrapping around (mod 256).
SubtractCompositeOp The result of composite image - image, with underflow wrapping around (mod 256). The add and subtract operators can be used to perform reversable transformations.
DifferenceCompositeOp The result of abs(composite image - image). This is useful for comparing two very similar images.
MultiplyCompositeOp  
BumpmapCompositeOp The result image shaded by composite image.
CopyCompositeOp  
CopyRedCompositeOp  
CopyGreenCompositeOp  
CopyBlueCompositeOp  
CopyOpacityCompositeOp  
ClearCompositeOp  
DissolveCompositeOp  
DisplaceCompositeOp  
ModulateCompositeOp  
ThresholdCompositeOp  
NoCompositeOp  
DarkenCompositeOp  
LightenCompositeOp  
HueCompositeOp  
SaturateCompositeOp  
ColorizeCompositeOp  
LuminizeCompositeOp  
ScreenCompositeOp  
OverlayCompositeOp  
CompressionType - The CompressionType constants are used to express the desired compression type when encoding an image. Be aware that most image types only support a sub-set of the available compression types. If the compression type specified is incompatable with the image, ×Magick selects a compression type compatable with the image type.

See Image#compression.

UndefinedCompression  
NoCompression  
BZipCompression BZip (Burrows-Wheeler block-sorting text compression algorithm and Huffman coding)  as used by bzip2 utilities
FaxCompression CCITT Group 3 FAX compression
Group4Compression CCITT Group 4 FAX compression (used only for TIFF)
JPEGCompression  
LosslessJPEGCompression This compression format is almost never used.
LZWCompression Lempel-Ziv-Welch (LZW) compression (caution, patented by Unisys)
RunlengthEncodedCompression  
ZipCompression Lempel-Ziv compression (LZ77) as used in PKZIP and GNU gzip.
DecorationType - The DecorationType constants can be used with the decorate= method in the Draw class to specify the text decoration for the annotate method.
NoDecoration  
UnderlineDecoration Underline the text.
OverlineDecoration Overline the text.
LineThroughDecoration Draw a horizontal line through the middle of the text.
DisposeType - The value of the Image#dispose attribute.
UndefinedDispose
NoneDispose
BackgroundDispose
PreviousDispose
FilterType - The FilterType constants are used to adjust the filter algorithm used when resizing images. Different filters experience varying degrees of success with various images and can take sigificantly different amounts of processing time. ×Magick uses the LanczosFilter by default since this filter has been shown to provide the best results for most images in a reasonable amount of time. Other filter types (e.g. TriangleFilter) may execute much faster but may show artifacts when the image is re-sized or around diagonal lines. The only way to be sure is to test the filter with sample images.

See Image#resize.

UndefinedFilter
PointFilter
BoxFilter
TriangleFilter
HermiteFilter
HanningFilter
HammingFilter
BlackmanFilter
GaussianFilter
QuadraticFilter
CubicFilter
CatromFilter
MitchellFilter
LanczosFilter
BesselFilter
SincFilter
GravityType - The GravityType constants specify positioning of an object (e.g. text, image) within a bounding region (e.g. an image). Gravity provides a convenient way to locate objects irrespective of the size of the bounding region, in other words, you don't need to provide absolute coordinates in order to position an object. A common default for gravity is NorthWestGravity.

See Draw#annotate and Image#composite.

ForgetGravity Don't use gravity.
NorthWestGravity Position object at top-left of region
NorthGravity Postiion object at top-center of region
NorthEastGravity Position object at top-right of region
WestGravity Position object at left-center of region
CenterGravity Position object at center of region
EastGravity Position object at right-center of region
SouthWestGravity Position object at left-bottom of region
SouthGravity Position object at bottom-center of region
SouthEastGravity Position object at bottom-right of region
ImageType - The ImageType constants indicate the type classification of the image.

See Image#image_type and Image::Info#image_type

UndefinedType  
BilevelType Monochrome image
GrayscaleType Grayscale image
PaletteType Indexed color (palette) image
PaletteMatteType Indexed color (palette) image with opacity
TrueColorType Truecolor image
TrueColorMatteTypeType Truecolor image with opacity
ColorSeparationType Cyan/Yellow/Magenta/Black (CYMK) image
ColorSeparationMatteType  
OptimizeType  
InterlaceType - The InterlaceType constants specify the ordering of the red, green, and blue pixel information in the image. Interlacing is usually used to make image information available to the user faster by taking advantage of the space vs time tradeoff. For example, interlacing allows images on the Web to be recognizable sooner and satellite images to accumulate/render with image resolution increasing over time.
Use LineInterlace or PlaneInterlace to create an interlaced GIF or progressive JPEG image.

See Image#interlace.

UndefinedInterlace  
NoInterlace Don't interlace image (RGBRGBRGBRGBRGBRGB...)
LineInterlace Use scanline interlacing (RRR...GGG...BBB...RRR...GGG...BBB...)
PlaneInterlace Use plane interlacing (RRRRRR...GGGGGG...BBBBBB...)
PartitionInterlace Similar to plane interlacing except that the different planes are saved to individual files (e.g. image.R, image.G, and image.B)
NoiseType - The NoiseType constants select the type of noise to be added to the image.

See Image#add_noise.

UniformNoise
GaussianNoise
MultiplicativeGaussianNoise
ImpulseNoise
LaplacianNoise
PoissonNoise
Opacity - The Opacity constants represent the maximum and minimum levels of opacity. You can specify a partial level of opacity by choosing a number between OpaqueOpacity and TransparentOpacity. For example, 25% opacity is abs(Magick::TransparentOpacity-Magick::OpaqueOpacity) * 0.25
TransparentOpacity The minimum amount of opacity.
OpaqueOpacity The maximum amount of opacity.
PaintMethod - The PaintMethod constants specify how pixel colors are to be replaced in the image.

See Image#matte_floodfill and Image#texture_floodfill.

PointMethod Replace pixel color at point.
ReplaceMethod Replace color for all image pixels matching color at point.
FloodfillMethod Replace color for pixels surrounding point until encountering pixel that fails to match color at point.
FillToBorderMethod Replace color for pixels surrounding point until encountering pixels matching border color.
ResetMethod Replace colors for all pixels in image with fill color.
RenderingIntent - Rendering intent is a concept defined by ICC Spec ICC.1:1998-09, "File Format for Color Profiles". ×Magick uses RenderingIntent in order to support ICC Color Profiles.

From the specification: "Rendering intent specifies the style of reproduction to be used during the evaluation of this profile in a sequence of profiles. It applies specifically to that profile in the sequence and not to the entire sequence. Typically, the user or application will set the rendering intent dynamically at runtime or embedding time."

See Image#rendering_intent.

UndefinedIntent  
SaturationIntent A rendering intent that specifies the saturation of the pixels in the image is preserved perhaps at the expense of accuracy in hue and lightness.
PerceptualIntent A rendering intent that specifies the full gamut of the image is compressed or expanded to fill the gamut of the destination device. Gray balance is preserved but colorimetric accuracy might not be preserved.
AbsoluteIntent Absolute colorimetric
RelativeIntent Relative colorimetric
ResolutionType - By default, ×Magick defines resolutions in pixels per inch. ResolutionType provides a means to adjust this.

See Image#units.

UndefinedResolution
PixelsPerInchResolution Density specifications are specified in units of pixels per inch (english units).
PixelsPerCentimeterResolution Density specifications are specified in units of pixels per centimeter (metric units).
StretchType - See Draw#font_stretch, Draw#font_stretch=.
NormalStretch
UltraCondensedStretch
ExtraCondensedStretch
CondensedStretch
SemiCondensedStretch
SemiExpandedStretch
ExpandedStretch
ExtraExpandedStretch
UltraExpandedStretch
AnyStretch
StyleType - See Draw#font_style, Draw#font_style=.
NormalStyle
ItalicStyle
ObliqueStyle
AnyStyle
WeightType - The font weight can be specified as one of 100, 200, 300, 400, 500, 600, 700, 800, or 900, or one of the following constants. See Draw#font_weight, Draw#font_weight=.
AnyWeight  
NormalWeight Equivalent to 400
BoldWeight Equivalent to 700
BolderWeight Increases weight by 100
LighterWeight Decreases weight by 100