Image.capture(silent=false, frame=false, descend=false, screen=false, borders=false) [ { optional arguments } ] ->
anImage
Reads an image from an X window. Unless you identify a
window to capture via the optional arguments block,
when capture is invoked the cursor will turn into
a cross. Click the cursor on the window to be captured.
Within the optional arguments block, specify
self.filename = "root" to capture the entire
desktop. To programatically specify the window to be captured,
use self.filename = window_id, where window_id is
the id displayed by xwininfo(1).
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 blob can be a string containing an image file such as a JPEG or GIF. The string can contain a multi-image file such as an animated GIF or a Photoshop image with multiple layers. A blob can also be one of the strings produced by to_blob. 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'
}
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.read_inline(content) [ { optional arguments } ] -> anArray
Converts a Base64-encoded image or multi-image sequence to an array of Image objects.
A Base64-encoded string. Generally no optional arguments are required. If the image format cannot be deduced from the image data, you can use the format attribute. If you want to extract a subset of an image sequence, you can use the scene and number_scenes attributes.
An array containing 0 or more Image objects. If the content is a multi-image sequence 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.
content = "R0lGODlhnAEuAferAAAAAAcIBggJBgw..." img = Magick::Image.read_inline(content)
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'
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, compare_channel
SignatureImage
image.adaptive_sharpen(radius=0.0, sigma=1.0) -> anImage
Adaptively sharpens the image by sharpening more intensely near image edges and less intensely far from edges. The adaptive_sharpen method sharpens the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and adaptive_sharpen selects a suitable radius for you.
A new image
AdaptiveSharpenImage (available in ImageMagick 6.2.7)
image.adaptive_sharpen(radius=0.0, sigma=1.0 [,channel...]) -> anImage
The same as adaptive_sharpen except only the
specified channels are sharpened.
adaptive_sharpen method, above.A new image
AdaptiveSharpenImageChannel (available in ImageMagick 6.2.7)
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
bilevel_channel, random_threshold_channel, threshold
AdaptiveThresholdImage
image.add_noise(noise_type) -> anImage
Adds random noise to the image. The amount of time
add_noise requires depends on the NoiseType
argument.
A NoiseType value.
A new image
AddNoiseImage
image.add_noise_channel(noise_type [,channel...]) -> anImage
Adds random noise to the specified channel or channels in the image.
add_noise method, above.A new image
AddNoiseImageChannel (available in ImageMagick 6.2.5)
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.auto_orient -> anImage
Rotates or flips the image based on the image's EXIF
orientation tag. Note that only some models of modern digital
cameras can tag an image with the orientation. If the image
does not have an orientation tag, or the image is already
properly oriented, then auto_orient returns an
exact copy of the image.
A new image
FlipImage, FlopImage, RotateImage, TransposeImage (available in ImageMagick 6.2.8), TransverseImage (available in ImageMagick 6.2.8)
image.auto_orient! -> self
Rotates or flips the image based on the image's EXIF
orientation tag. Note that only some models of modern digital
cameras can tag an image with the orientation. If the image
does not have an orientation tag, or the image is already
properly oriented, then auto_orient! returns
nil.
self. or nil if the image is already properly
oriented
image.bilevel_channel(threshold [,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)
adaptive_threshold, random_threshold_channel
BilevelImageChannel
image.blur_channel(radius=0.0, sigma=1.0[, channel...]]) -> anImage
Blurs the specified channel. We
convolve the image with a Gaussian operator of the given radius
and standard deviation (sigma) . The blur_channel
method differs from gaussian_blur_channel
in that it uses a separable kernel which is faster but
mathematically equivalent to the non-separable
kernel.
For reasonable results, the radius should be larger than sigma. Use a radius of 0 and
blur_channel selects a suitable radius for
you.
A new image
blur_image, gaussian_blur_channel, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,