Image.capture(silent=false, frame=false, descend=false, screen=false, borders=false) [ { optional arguments } ] ->
    anImage
Reads an image from an X window.
true, suppress the beeps that signal the
      start and finish of the capture process. The bell rings once
      to signal the start of the capture and twice to signal the
      finish.true, include the window frame.true, obtain image
      by descending window hierarchy.true, specifies that the GetImage request used to obtain the image
      should be done on the root window, rather than directly on
      the specified window. In this way, you can obtain pieces of
      other windows that overlap the specified window, and more
      importantly, you can capture menus or other popups that are
      independent windows but appear over the specified
      window.true, include the border in the
      image.A new image.
img = Magick::Image.capture {
    self.filename = "root"
    }
  Image.constitute(width, height, map, pixels) -> anImage
Creates an image from an array of pixels. This method is the
    reverse of dispatch.
Integers or all Floats. If the
      elements are Integers, the Integers
      must be in the range [0..MaxRGB]. If the elements are
      Floats, they must be in the range [0..1].An image constructed from the pixel data.
 
    ConstituteImage
Image.from_blob(aString) [ { optional arguments } ] -> anArray
Creates an array of images from a BLOB, that is, a Binary Large OBject. In RMagick, a BLOB is a string.
A string produced by the to_blob method. Control the format of the created image(s) by setting additional Image::Info attributes in the optional block argument.
An array of one or more images constructed from the BLOB.
See to_blob.
BlobToImage
Image.new(columns, rows [, fill]) [ { optional arguments } ] -> anImage
Fill
      objectA new image.
img = Magick::Image.new(256, 64) {
  self.background_color = 'red'
  }
    ImageList.new_image
    AllocateImage
Image.ping(filename) [ { optional arguments } ] ->
    anArray
    Image.ping(file) [ {
    optional arguments } ] -> anArray
Creates one or more images from the image file, omitting the
    pixel data. Only the attributes are stored in the images. This
    method is faster than read and
    uses less memory.
An image file name or open file object. You can specify other arguments by setting Image::Info attributes in the optional block.
An array containing 0 or more images.
cheetah = Magick::Image.ping("Cheetah.jpg") »
      [Cheetah.jpg JPEG 1024x768 DirectClass 8-bit 101684b]
p cheetah[0].rows    » 768
p cheetah[0].columns » 1024
    PingImage
Image.read(filename) [ { optional arguments } ] ->
    anArray
    Image.read(file) [ {
    optional arguments } ] -> anArray
Creates one or more images from the image file.
An image file name or open file object. You can specify other arguments by setting Image::Info attributes in the optional block.
An array containing 0 or more Image objects. If the file is a multi-image file such as an animated GIF or a Photoshop PSD file with multiple layers, the array contains an Image object for each image or layer in the file.
animated = Magick::Image.read("animated.gif") »
[animated.gif GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b
animated.gif[1] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b,
animated.gif[2] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b]
    ReadImage
image[key] -> aString
Returns the value of the image property identified by
    key. An image may have any number of
    properties. Each property is identified by a string (or symbol)
    key. The property value is a string. ×Magick predefines
    some properties, including Label,
    Comment, Signature, and in some cases
    EXIF.
String or a
    Symbol.
    The value of the property.
mom['Label'] = 'My Mother'
[ ]=,
    properties
    GetImageAttribute
×Magick calls properties "attributes." I use the word
    "properties" to reduce the confusion with image object
    attributes such as rows and
    columns.
image[key] = aString -> image
Sets the value of an image property. An image may have any number of properties.
self
    SetImageAttribute
image <=> anOtherImage -> -1, 0, 1
Compares two images and returns -1, 0, or 1 if image is less than, equal to, or greater than
    anOtherImage as determined by
    comparing the signatures of the images. If one of the arguments
    is not an image, this method raises a TypeError exception (in
    Ruby 1.6) or returns nil (in Ruby 1.8)
In addition to <=>, Image mixes in the
    Comparable module, which defines the <, <=,
    == >=, >, and between? methods.
The difference method compares images (for
    equality only) but also returns information about the amount
    two images differ, which may be more useful.
The value of image.signature <=>
    anOtherImage.signature.
signature, difference, channel_compare
SignatureImage
image.adaptive_threshold(width=3, height=3, offset=0) -> anImage
Selects an individual threshold for each pixel based on the range of intensity values in its local neighborhood. This allows for thresholding of an image whose global intensity histogram doesn't contain distinctive peaks.
A new image
channel_threshold, random_channel_threshold, threshold
AdaptiveThresholdImage (available in ImageMagick 5.5.2 and later)
image.add_noise(aNoiseType) -> anImage
Adds random noise to the image. The amount of time
    add_noise requires depends on the NoiseType
    argument.
A NoiseType constant.
A new image
AddNoiseImage
image.affine_transform(anAffineMatrix) -> anImage
Transforms the image as specified by the affine matrix.
See Coordinate system transformations in the Scalable Vector Graphics (SVG) 1.0 Specification for more information about transformation matrices.
An AffineMatrix
    object.
A new image
The affine matrix in this example scales the receiver by -1 in both the x- and y-direction, and skews it by π/6 radians along both axes.
AffineTransformImage
image.annotate(draw, width, height, x, y, text) [ { additional parameters } ] -> image
This is the same method as the annotate method
    in the Draw class, except that the first argument is a Draw
    object. Refer to the documentation for Draw#annotate for more information.
    Some users feel like annotate is better placed in
    Image than in Draw. Okay, here it is!
self
image.bilevel_channel(threshold, [channel[, channel...]] = aNewImage
Changes the value of individual pixels based on the intensity of each pixel channel. The result is a high-contrast image.
MaxRGB.A new image
bilevel_channel(2*MaxRGB/3, RedChannel)
BilevelImageChannel (available in ImageMagick 6.0.0)
image.blur_image(radius=0.0, sigma=1.0) -> anImage
Blurs the image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma).
For reasonable results, the radius should be larger than sigma. Use a radius of 0
    and blur_image selects a suitable radius for you.
A new image.
BlurImage
image.black_threshold(red_channel [, green_channel [, blue_channel [, opacity_channel]]]) -> anImage
Forces all pixels below the threshold into black while leaving all pixels above the threshold unchanged.
Each channel argument is a number between 0 and MaxRGB. All arguments except the first may be omitted. If the green_channel or blue_channel argument is omitted, the default value is the red_channel value. If the opacity_channel argument is omitted, the default value is OpaqueOpacity.
A new image
BlackThresholdImage (available in ImageMagick 5.5.7 and GraphicsMagick 1.1)
image.border(width, height, color) -> anImage
Add a border around the image.
A new image
BorderImage
image.border!(width, height, color) -> self
image.change_geometry(aString) {|cols,rows,image| block} -> ??? (see Returns)
    image.change_geometry(aGeometry) {|cols,rows,image| block} -> ??? (see Returns)
The change_geometry method supports resizing a
    method by specifying constraints. For example, you can specify
    that the image should be resized such that the aspect ratio
    should be retained but the resulting image should be no larger
    than 640 pixels wide and 480 pixels tall.
The argument may be either a geometry string or a Geometry object.
    Change_geometry yields to the block, passing new
    width and height values based on the argument with respect to
    self. The return value is the return value of the
    block.
Geometry object
    The value returned by the block
mona = Magick::Image.read('MonaLisa.jpg').first
mona.change_geometry!('320x240') { |cols, rows, img|
  img.resize!(cols, rows)
  }
    ParseSizeString
change_geometry! is an alias for
    change_geometry.
image.changed? ->
    true or false
true if any pixel has
    been altered since the image was constituted.
    IsTaintImage
image.channel(aChannelType) -> anImage
Extracts a channel from the image. A channel is a particular color component of each pixel in the [image].
A ChannelType constant.
An image in which the RGB values of all the pixels have been set to a gray corresponding to the specified channel value. For example, given a pixel in the original image with the value R=255, G=128, B=0 and the RedChannel argument, the equivalent pixel in the result image will have the value R=255, G=255, and B=255. For the BlueChannel argument, the pixel would have the value R=0, G=0, B=0.
The channel image preserves the tone of the selected RGB component.
ChannelImage
image.channel_compare(img, metric [, channel...]) -> [anImage, aFloat]
Compares img with the receiver.
An array. The first element is a difference image, the
    second is a the value of the computed distortion represented as
    a Float.
ImageCompareChannels (available in ImageMagick 6.0.0)
image.channel_depth([channel [, channel]...]) -> aNumeric
Returns the maximum depth for the specified channel or channels.
The maximum depth
GetImageChannelDepth (available in ImageMagick 6.0.0)
image.channel_extrema([channel [, channel]...]) -> [aNumeric, aNumeric]
Returns the minimum and maximum intensity values for the specified channel or channels.
AllChannels value is not
      supported.An array. The first element in the array is the minimum value. The second element is the maximum value.
GraphicsMagick users see statistics
GetImageChannelExtrema (available in ImageMagick 6.0.0), GetImageStatistics (available in GraphicsMagick 1.1)
image.channel_mean([channel [, channel]...]) -> [aNumeric, aNumeric]
Returns the mean and standard deviation values for the specified channel or channels.
AllChannels value is not
      supported.An array. The first element in the array is the mean value. The second element is the standard deviation.
GraphicsMagick users see statistics
GetImageChannelMean (available in ImageMagick 6.0.0), GetImageStatistics (available in GraphicsMagick 1.1)
image.channel_threshold(red_channel, [green_channel[, blue_channel[, opacity_channel]]]) -> anImage
Creates a high-contrast image by changing the pixels based on the intensity of each pixel channel.
A new image
ThresholdImageChannel
image.charcoal(radius=0.0, sigma=1.0) -> anImage
Adds a "charcoal" effect to the image. You can alter the intensity of the effect by changing the radius and sigma arguments.
A new image
CharcoalImage
image.chop(x, y, width, height) -> anImage
Removes the specified rectangle and collapses the rest of the image to fill the removed portion.
A new image
The chop rectangle is highlighted in the "before" image. The result may seem counter-intuitive!
ChopImage
image.color_fill_to_border(x, y, fill_color) -> anImage
Changes any pixel that is a neighbor of the target pixel and is not the border color to the fill color.
A new image
In this example, the aquamarine fill starts at the center of
    the circle and fills to the black border. All non-black pixels
    are replaced by the fill color. Contrast the result of
    color_fill_to_border with that of
    color_floodfill example, below.
ColorFloodfillImage
image.clone -> anImage
Same as dup except the frozen state of the original is propogated to the new copy.
A new image
image.color_floodfill(x, y, fill_color) -> anImage
Changes any pixel that is the same color and is a neighbor of the target pixel to the fill color.
A new image
In this example, the aquamarine fill starts at the center of
    the circle and replaces all neighboring white pixels. Contrast
    the result of color_floodfill with that of
    color_fill_to_border, above.
ColorFloodfillImage
image.color_histogram() -> aHash
Computes the number of times each unique color appears in the image.
A hash. Each key in the hash is a Pixel representing a color that appears
    in the image. The value associated with the key is the number
    of times that color appears in the image. Caution: if
    the image contains many colors the hash will be very large. You
    may want to use the quantize
    method to reduce the number of colors before using
    color_histogram.
This histogram was produced by sorting the hash returned by
    color_histogram by increasing frequency.
image.colorize(red_pct, green_pct, blue_pct, [matte_pct, ] fill) -> anImage
Blend the fill color with the image pixels. The red_pct, green_pct, blue_pct and matte_pct arguments are the percentage to blend with the red, green, blue and matte channels.
.25 is 25%. The matte_pct argument
      is optional.A new image
This example converts a color image to sepia-tone using the
    quantize and
    colorize methods.
ColorizeImage
image.colormap(index[, new_color]) -> aString
Returns the color in the color map at the specified index. If the new_color argument is specified, replaces the color at that index with the new color.
Raises IndexError if the image does not contain a color map. Only PseudoClass images have a color map.
colormap
      raises an IndexError. You can get the number of colors in the
      color map from the colors attribute.The name of the color at the specified location in the color map
image.color_point(x, y, fill) -> anImage
A new image
f.color_point(50,50, 'red')
GetImagePixels, SyncImagePixels
image.color_reset!(fill) -> image
Sets all the pixels in the image to the specified fill color.
f.color_reset!(red)
image.composite(img, x, y, composite_op) ->
    anImage
    image.composite(img, gravity,
    composite_op) ->
    anImage
    image.composite(img, gravity,
    x, y,
    composite_op) ->
    anImage
The composite method can be called three different ways:
A new image
This example shows the effect of some of the composite operators.
CompositeImage
image.composite!(img, x, y, composite_op) ->
    self
    image.composite!(img, gravity,
    composite_op) ->
    self
    image.composite!(img, gravity,
    x, y,
    composite_op) -> self
image.composite_affine(img, affine) -> anImage
AffineMatrixA new image
DrawAffineImage
image.compress_colormap! -> image
Removes duplicate or unused entries in the colormap. Only PseudoClass images have a colormap.
f = Magick::Image.read('cbezier1.gif').first »
         cbezier1.gif GIF 500x350+0+0 PseudoClass 128c 8-bit 177503b
f.colors » 128
f.compress_colormap! »
         cbezier1.gif GIF 500x350+0+0 PseudoClass 108c 8-bit 177503b
f.colors » 108
    CompressColormap
image.contrast(sharpen=false) ->
    anImage
Enhances or reduces the intensity differences between the lighter and darker elements of the image.
true, the contrast is increased, otherwise it is
    reduced.
    A new image
In this example the contrast is reduced in each successive image.
 
    ContrastImage
>image.convolve(order, kernel) -> anImage
Applies a custom convolution kernel to the image.
Float values.A new image
convolve_channel. The edge, emboss, gaussian_blur, motion_blur and sharpen methods use convolution to do their work.
ConvolveImage
See Convolution in the Hypermedia Image Processing Reference
image.convolve_channel(order, kernel[, channel[, channel...]]) -> anImage
Applies a custom convolution kernel to the specified channel or channels in the image.
Float values.A new image
ConvolveImageChannel (available in ImageMagick 6.0.0)
image.copy -> anImage
f2 = f.copy
CloneImage
image.crop(x, y, width, height) ->
    anImage
    image.crop(gravity, x, y, width, height) -> anImage
    image.crop(gravity, width,
    height) -> anImage
The crop method can be called three different ways:
A new image
The crop rectangle is highlighted in the "before" image.
CropImage
image.crop!(x, y, width, height) ->
    image
    image.crop!(gravity, x, y, width, height) -> image
    image.crop!(gravity, width,
    height) -> image
image.cycle_colormap(amount) -> anImage
Displaces the colormap by a given number of positions. If you cycle the colormap a number of times you can produce a psychedelic effect.
The number of positions to cycle.
A new image
Mouse over the image to see an animation made by cycling the colormap between each copy.
CycleColormapImage
image.despeckle -> anImage
Reduces the speckle noise while preserving the edges.
A new image
DespeckleImage
image.difference(other) -> anArray
Compares two images and computes statistics about their difference.
A small normalized mean square error...suggests the images are very similiar in spatial layout and color.
An array of three Float values:
After difference returns, these values are also
    available from the mean_error_per_pixel,
    normalized_mean_error,
    and normalized_maximum_error
    attributes.
image.dispatch(x, y, columns, rows,
    map, float=false) ->
    anArray
Extracts the pixel data from the specified rectangle and
    returns it as an array of either Integer or
    Float values.
The array returned by dispatch is suitable for
    use as an argument to constitute.
String reflecting the order of the pixel
      data. It can be any combination or
      order of R = red, G = green, B = blue, A = alpha, C = cyan, Y
      = yellow, M = magenta, K = black, or I = intensity (for
      grayscale).true, the returned array elements will be
      Float values in the range 0..1. If
      false, the returned array elements will be
      Integer values in the range 0..MaxRGB.
#! /usr/local/bin/ruby -w
require 'RMagick'
f = Magick::Image.read("images/Flower_Hat.jpg").first
pixels = f.dispatch(0,0,f.columns,f.rows,"RGB")
# Write the pixels to a file, to be included
# in the constitute.rb example.
File.open('pixels-array', 'w') { |txt|
    txt.puts("Width = #{f.columns}")
    txt.puts("Height = #{f.rows}")
    txt.print('Pixels = [')
    pixels = pixels.join(',')
    pixels.gsub!(/(\d+,){1,25}/) { "#{$&}\n" }
    txt.print(pixels)
    txt.puts(']')
}
exit
    constitute, export_pixels, get_pixels
DispatchImage, or ExportImagePixels in ImageMagick 5.5.7
This method is deprecated in ImageMagick 5.5.7 and later.
    Use the export_pixels method instead.
image.display [ { optional arguments } ] -> image
Display the image on an X Window screen. By default, the screen is the local monitor. Right-click the window to display a context menu.
You can specify additional arguments by setting Info
    attributes in a block associated with the method call.
    Specifically, you can set the name of a non-default X Window
    screen with the server_name
    attribute.
self
DisplayImages
image.dup -> anImage
image.each_profile {|name, value| block} -> ??? (see Returns)
image.edge(radius=0.0) -> anImage
edge selects a suitable default.
    A new image
EdgeImage
image.emboss(radius=0.0, sigma=1.0) -> anImage
A new image
EmbossImage