image.preview(aPreviewType) -> anImage
Creates an image that contains 9 small versions of the receiver image. The center image is the unchanged receiver. The other 8 images are variations created by transforming the receiver according to the specified preview type with varying parameters.
A preview image is an easy way to "try out" a transformation method.
One of the following PreviewType constants:
A new image
This half-size preview demonstrates the SolarizePreview argument.
PreviewImage
image.profile!(name, profile) -> image
Adds or removes a ICM, IPTC, or
generic profile from an image. If profile
is nil
, the specified profile is removed from the
image. Use profile('*', nil)
to remove all
profiles from the image.
nil
to cause the
profile to be removed.self
add_profile and
delete_profile perform
very similar functions. However, add_profile
accepts the name of a profile file on disk instead of the
profile data itself and, if the file contains more than one
profile, will load all the profiles at once.
ProfileImage
×Magick does not automatically remove profiles when
resizing images. If you are trying to make your JPEG thumbnail
images as small as possible, use profile!
to
remove any profiles from the image as well. Also see strip!
image.properties [ {|name,value| block} ] -> aHash
If called with an associated block, properties
runs the block once for each property defined for the image.
The block arguments are the property name and its value. If
there is no block, properties
returns a hash with
one element for each property. The hash key is the property
name and the associated value is the property value.
If called without a block, returns a hash, otherwise returns
self
.
The EXIF property is not created until the first time an EXIF tag or entry number is referenced.
image.quantize(number_colors=256, colorspace=Magick::RGBColorspace, dither=true
, tree_depth=0, measure_error=false
) ->
anImage
Analyzes the colors within a reference image and chooses a fixed number of colors to represent the image. The goal of the algorithm is to minimize the difference between the input and output image while minimizing the processing time.
true
to apply
Floyd/Steinberg error diffusion to the image. When the size
of the color palette is less than the image colors, this
trades off spacial resolution for color resolution by
dithering to achieve a similar looking image.true
to calculate
quantization errors when quantizing the image.A new image
See the example for colorize.
ordered_dither, posterize, ImageList#quantize
QuantizeImage
image.quantum_operator(operator, rvalue, channel=AllChannels) -> anImage
Performs the requested integer arithmetic operation on the
selected channel of the image. This method allows simple
arithmetic operations on the component values of all pixels in
an image. Of course, you could also do this in Ruby using
get_pixels and store_pixels, or view,
but quantum_operator
will be faster, especially
for large numbers of pixels, since it does not need to convert
the pixels from C to Ruby.
QuantumExpressionOperator
constants:
AndQuantumOperator
DivideQuantumOperator
LShiftQuantumOperator
MaxQuantumOperator*
MinQuantumOperator*
MultiplyQuantumOperator
OrQuantumOperator
RShiftQuantumOperator
SubtractQuantumOperator
XorQuantumOperator
Numeric
operation rvalue.self
Divide the red component of all the pixels in the image by 2:
img.quantum_operator(DivideQuantumOperator, 2, RedChannel)
The Image:View class supports operations on individual pixels and collections of pixels, as well as operations on channels within pixels. See view, below.
image.radial_blur(aFloat) -> anImage
Applies a radial blur to the image.
A new image
blur_image, gaussian_blur, motion_blur, radial_blur_channel
RadialBlurImage
image.radial_blur_channel(aFloat [, channel...]) -> anImage
Applies a radial blur to the selected image channels.
A new image
RadialBlurImageChannel (available in ImageMagick 6.2.4)
image.raise(width=6, height=6,
raised=true
) ->
anImage
Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image.
true
, the image is raised, otherwise
lowered.A new image
RaiseImage
image.random_threshold_channel( thresholds, [channel...] ) -> anImage
Changes the value of individual pixels based on the intensity of each pixel compared to a random threshold. The result is a low-contrast, two color image.
A new image
geom = Geometry.new(MaxRGB/2) random_threshold_channel(geom, RedChannel)
adaptive_threshold, bilevel_channel, threshold
RandomThresholdImageChannel
image.recolor(color_matrix) -> anImage
Use this method to translate, scale, shear, or rotate image colors. Although you can use variable sized matrices, typically you use a 5×5 for an RGBA image and a 6×6 for CMYKA. Populate the last row with normalized values to translate.
An array of Float values representing the recolor matrix.
RecolorImage (introduced in ImageMagick 6.3.1)
image.reduce_noise(radius) -> anImage
Smooths the contours of an image while still preserving edge information. The algorithm works by replacing each pixel with its neighbor closest in value.
reduce_noise
selects a suitable
radius for you.A new image
The left side of the image has been modified by add_noise
. The right side
has been filtered by reduce_noise(0)
.
ReduceNoiseImage
image.resample(horizontal_res=72.0[, vertical_res]) -> anImage
Resample image to specified horizontal and vertical resolution.
Resize the image so that its rendered size remains the same as the original at the specified target resolution. For example, if a 300 DPI image renders at 3 inches by 2 inches on a 300 DPI device, when the image has been resampled to 72 DPI, it will render at 3 inches by 2 inches on a 72 DPI device. Note that only a small number of image formats (e.g. JPEG, PNG, and TIFF) are capable of storing the image resolution. For formats which do not support an image resolution, the original resolution of the image must be specified via the density attribute prior to specifying the resample resolution.
image.resize(new_width, new_height,
filter=LanczosFilter,
support=1.0) -> image
image.resize(scale_factor) -> anImage
Changes the size of the receiver to the specified dimensions.
You can specify the new size in two ways. Either specify the new width and height explicitly, or specify a scale factor, a number that represents the percentage change.
Use the change_geometry method to resize an image with constraints such as "maintain the current proportions."
resize
uses the value of the receiver's blur attribute.A new image
change_geometry, resize!, magnify, minify, sample, scale, thumbnail
ResizeImage
image.resize!(new_width,
new_height, filter=LanczosFilter,
support=1.0) -> image
image.resize!(scale_factor) -> image
image.resize_to_fit(new_width, new_height) -> anImage
A convenience method. Resize the image to fit within the specified dimensions while retaining the original aspect ratio.
A new image
image.resize_to_fit!(new_width, new_height) -> image
image.roll(x_offset, y_offset) -> anImage
Offsets an image as defined by x_offset and y_offset.
A new image
This image has been offset 25% in both directions.
RollImage
image.rotate(amount [, qualifier]) -> anImage
Rotate the receiver by the specified angle. Positive angles rotate clockwise while negative angles rotate counter-clockwise. New pixels introduced by the rotation are the same color as the current background color. Set the background color to "none" to make the new pixels transparent black.
A new image, or nil
if the image was not
rotated because it did not meet the qualification specified by
the second argument.
RotateImage
image.rotate!(amount [, qualifier]) -> image
In-place form of rotate.
self, or nil
if the image was not rotated
because it did not meet the qualification specified by the
second argument.
image.sample(new_width, new_height)
-> anImage
image.sample(scale_factor) -> anImage
Scales an image to the desired dimensions with pixel sampling. Unlike other scaling methods, this method does not introduce any additional color into the scaled image.
A new image
sample!, magnify, minify, resize, scale, thumbnail
SampleImage
image.sample!(new_width, new_height)
-> image
image.sample!(scale_factor) -> image
image.scale(new_width, new_height)
-> anImage
image.scale(scale_factor) -> anImage
Changes the size of an image to the given dimensions.
A new image
scale!, magnify, minify, resize, sample, thumbnail
ScaleImage
image.scale!(new_width, new_height)
-> image
image.scale!(scale_factor) -> image
image.segment(colorspace=RGBColorspace, cluster_threshold=1.0, smoothing_threshold=1.5, verbose=false
) ->
anImage
Segments an image by analyzing the histograms of the color components and identifying units that are homogeneous with the fuzzy c-means technique.
ColorspaceType
value. Empirical evidence suggests that
distances in YUV or YIQ correspond to perceptual color
differences more closely than do distances in RGB space. The
image is then returned to RGB colorspace after color
reduction.true
, segment
prints
detailed information about the identified classes.A new image
segment(Magick::YUVColorspace, 0.4, 0.4)
SegmentImage
image.sepiatone(threshold=MaxRGB) -> anImage
Applies a special effect to the image, similar to the effect achieved in a photo darkroom by sepia toning.
MaxRGB
and is a measure of the extent
of the sepia toning. A threshold of 80% is a good starting
point for a reasonable tone. The default is MaxRGB.self
You can get more control by using colorize.
SepiaToneImage (available in ImageMagick 6.2.1)
image.set_channel_depth(channel, depth) -> self
Sets the depth of the image channel.
self
SetImageChannelDepth
image.shade(shading=false
, azimuth=30, elevation=30)
-> anImage
Shines a distant light on an image to create a three-dimensional effect. You control the positioning of the light with azimuth and elevation; azimuth is measured in degrees off the x axis and elevation is measured in pixels above the Z axis.
true
, shade
shades the
intensity of each pixel.A new image
shade(true, 50, 50)
ShadeImage
image.shadow(x_offset=4, y_offset=4, sigma=4.0, opacity=1.0) -> anImage
A new image
ShadowImage (available in ImageMagick 6.1.7)
The shadow image is 2×sigma pixels larger on a side than the original image, as can be seen in the example above.
image.sharpen(radius=0.0, sigma=1.0) -> anImage
Sharpens an image. We convolve 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 sharpen
selects a suitable radius for you.
The radius and standard deviation of the Gaussian operator.
A new image
SharpenImage
image.sharpen_channel( radius, sigma [,channel...] ) -> anImage
Sharpens one or more image channels. We
convolve 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 sharpen_channel
selects a suitable radius for
you.
A new image
SharpenImageChannel (available in ImageMagick 6.0.1)
image.shave(width, height) -> anImage
Removes pixels from the edges of the image, leaving the center rectangle.
A new image
ShaveImage
image.shave!(width, height) -> image
image.shear(x_shear, y_shear) -> anImage
Shearing slides one edge of an image along the X or Y axis, creating a parallelogram. An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x_shear is measured relative to the Y axis, and similarly, for Y direction shears y_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color.
The X and Y shear angles, measured in degrees. These values must not be 180.0. If either value is 0, no shearing will occur.
A new image
ShearImage
image.sigmoidal_contrast_channel(contrast=3.0, midpoint=50.0, sharpen=false[,channel...]) -> anImage
Adjusts the contrast of an image channel with a non-linear sigmoidal contrast algorithm. Increases the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows.
true
to increase the image contrast otherwise
the contrast is reduced.A new image
SigmoidalContrastImageChannel (available in ImageMagick 6.2.1)
image.signature -> aString
Computes a message digest from an image pixel stream with an implementation of the NIST SHA-256 Message Digest algorithm. This signature uniquely identifies the image and is convenient for determining if an image has been modified or whether two images are identical.
×Magick adds the computed signature to the image's properties.
The signature as a 64-character string.
img = Image.read('ex/images/Flower_Hat.jpg').first » ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b img.properties » {"comment"=>"File written by Adobe Photoshop\250 4.0"} img.signature » "485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b" img.properties » {"signature"=>"485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b", "comment"=>"File written by Adobe Photoshop\250 4.0"}
SignatureImage
image.sketch(radius=0.0, sigma=1.0, angle=0.0) -> anImage
Simulates a pencil sketch. For best results start with a grayscale image.
A new image
SketchImage (available in ImageMagick 6.2.8)
image.solarize(threshold=50) -> anImage
Applies a special effect to the image similar to the effect achieved in a photo darkroom by selectively exposing areas of photo sensitive paper to light.
Ranges from 0 to MaxRGB and is a measure of the extent of the solarization. The default is 50.
A new image
SolarizeImage
image.splice(x, y, width, height[, color]) -> anImage
Splice a solid color into the image as defined by the
x
, y
, width
, and
height
arguments. This method is the opposite of
chop.
A new image
color_fill_to_border, color_floodfill, color_reset!, erase!, opaque
SpliceImage
image.spread(radius=3) -> anImage
Randomly displaces each pixel in a block defined by the radius parameter.
A new image
SpreadImage
image.statistics -> see below
Computes the minimum, maximum, mean, standard deviation, and variance for each channel in the image.
The statistics method returns a Statistics
class object. This class defines four channel
attributes: red
, green
,
blue
, and opacity
. Each channel
attribute is a Statistics::Channel
class object.
This class defines 5 statistic attributes:
min
, max
, mean
stddev
, and var
. See the example
below.
require 'pp' img = Image.read("Flower_Hat.jpg").first stats = img.statistics pp stats » #<Magick::Statistics red= #<Magick::Statistics::Channel max=1.0, min=0.0, mean=0.627182352941187, stddev=0.231399683489667, var=0.0535458135191179>, green= #<Magick::Statistics::Channel max=1.0, min=0.0, mean=0.571999607843132, stddev=0.22246563644744, var=0.0494909593999647>, blue= #<Magick::Statistics::Channel max=1.0, min=0.0, mean=0.508869725490209, stddev=0.269422111063184, var=0.0725882739297426>, opacity= #<Magick::Statistics::Channel max=0.0, min=0.0, mean=0.0, stddev=0.0, var=0.0>> p stats.red.stddev » 0.231399683489667
image.stegano(watermark, offset) -> anImage
Hides a digital watermark in the receiver. You can retrieve
the watermark by reading the file with the
stegano:
prefix, thereby proving the authenticity
of the file.
The watermarked image must be saved in a lossless RGB format such as MIFF, or PNG. You cannot save a watermarked image in a lossy format such as JPEG or a pseudocolor format such as GIF. Once written, the file must not be modified or processed in any way.
A copy of the image containing the embedded watermark.
SteganoImage
image.stereo(offset_image) -> anImage
Combines two images and produces a single image that is the composite of a left and right image of a stereo pair. Special red-green stereo glasses are required to view this effect.
Another image or imagelist. If the argument is an imagelist, uses the current image.
A new image
StereoImage
image.store_pixels(x, y, columns, rows, pixels) -> image
Replace the pixels in the specified rectangle with the pixels in the pixels array.
rows*columns
.The image, with the rectangle suitably altered.
Also see the example for get_pixels
.
SetImagePixels, SyncImagePixels
image.strip! -> image
Strips an image of all profiles and comments.
self
image.swirl(degrees) -> anImage
Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360.
The number of degrees to swirl the image.
A new image
This example is an animated image. Mouse over the image to start the animation.
SwirlImage
image.texture_fill_to_border(x, y, texture) -> anImage
Replaces the target pixel at x, y and its neighbors that are not the border color with copies of the texture image. Use the fuzz attribute to specify how closely a pixel must match the border color.
A new image
In this example the target is the pixel in the center of the
image. The texture - in this case a picture of a girl in a
flowered hat - replaces this pixel and its neighbors until
reaching a black pixel. Mouse over the image to see the
original image. Notice the plum-colored circles are replaced as
well. Compare this result with the result of
texture_floodfill
, below.
color_fill_to_border, matte_fill_to_border
ColorFloodfillImage
image.texture_floodfill(x, y, texture) -> anImage
Replaces the target pixel at x, y and its neighbors that are the same color with the texture image. By default, the neighbor pixels must be exactly the same color as the target pixel. Use the fuzz attribute to specify how much difference is acceptable.
A new image
In this example the target is the pixel in the center of the
image. The texture - in this case a picture of a girl in a
flowered hat - replaces this pixel and its same-colored
neighbors. Mouse over the image to see the original image.
Notice the plum-colored circles are not replaced. Compare this
result with the result of texture_fill_to_border
,
above.
color_floodfill, matte_floodfill
ColorFloodfillImage
image.threshold(threshold) -> anImage
Changes the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image.
A value between 0 and MaxRGB.
A new image
threshold(Magick::MaxRGB*0.55)
adaptive_threshold, bilevel_channel, random_threshold_channel
ThresholdImage
image.thumbnail(new_width, new_height)
-> anImage
image.thumbnail(scale_factor) -> anImage
The thumbnail
method is a fast resizing method
suitable for use when the size of the resulting image is <
10% of the original.
You can call thumbnail
with either the new
width and height or the scale factor.
0.095
.A new image
img = Magick::Image.read("images/Cheetah.jpg").first thumbnail = img.thumbnail(img.columns*0.09, img.rows*0.09)
ThumbnailImage
image.thumbnail!(new_width, new_height)
-> image
image.thumbnail!(scale_factor) -> image
image.to_blob [ { optional arguments } ]-> aString
Creates a Binary Large OBject, a direct-to-memory version of the image. The from_blob method constructs an image from a BLOB created by this method.
No required arguments, however you can specify the image format (such as JPEG, PNG, etc.) and depth by calling the format and depth attributes, as well as other Image::Info attributes as appropriate, in a block associated with the method.
A string containing the image data represented as a BLOB.
ImageToBlob
image.to_color(aPixel) -> aString
Returns the color name for a pixel. Unlike the
Pixel#to_color
method, to_color uses the depth and matte attributes of the image
to determine the color name.
A Pixel object.
A color name.
img = Image.read('ex/images/Flower_Hat.jpg').first » ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b pixel = img.pixel_color(img.columns/2, img.rows/2) » #<struct Magick::Pixel red=216, green=147, blue=106, opacity=0> img.to_color(pixel) » "#D8936A"
QueryColorname
image.transparent(color, opacity=Magick::TransparentOpacity) -> anImage
Changes the opacity value of all the pixels that match color to the value specified by opacity. By default the pixel must match exactly, but you can specify a tolerance level by setting the fuzz attribute on the image.
A new image
Mouse over the image to see the original. In this example, all the black pixels are made transparent. The resulting image has been composited over a plasma background, which shows through the transparent pixels.
TransparentImage
image.transpose -> anImage
Creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them by 90 degrees.
A new image
flip, flop, rotate, transpose!, transverse
TransposeImage (available in ImageMagick 6.2.8)
image.transpose! -> self
image.transverse -> anImage
Creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them by 270 degrees
A new image
flip, flop, rotate, transpose, transverse!
TransposeImage (available in ImageMagick 6.2.8)
image.transverse! -> self
image.trim -> anImage
Removes the edges that are exactly the same
color as the corner pixels. Use the fuzz attribute to make
trim
remove edges that are nearly the same color
as the corner pixels.
A new image
CropImage
image.trim! -> self
image.unique_colors -> anImage
Constructs a new image with one pixel for each unique color in the image. The new image has 1 row. The row has 1 column for each unique pixel in the image.
A new image
UniqueImageColors (available in ImageMagick 6.2.9)
image.unsharp_mask(radius=0.0, sigma=1.0, amount=1.0, threshold=0.05) -> anImage
Sharpens an image. We convolve 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
unsharp_mask
selects a suitable radius for
you.
All arguments are optional.
A new image
enhance, median_filter, reduce_noise, unsharp_mask_channel
UnsharpMaskImage
image.unsharp_mask_channel(radius=0.0, sigma=1.0, amount=1.0, threshold=0.05 [,channel...]) -> anImage
Sharpens an image. We convolve 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
unsharp_mask_channel
selects a suitable radius for
you.
Only the specified channels are sharpened.
All arguments are optional.
A new image
enhance, median_filter, reduce_noise, unsharp_mask
UnsharpMaskImageChannel (available in ImageMagick 6.1.0)
image.view(x, y, width, height) ->
aView
image.view(x,
y, width,
height) { |view|
block } -> nil
View
is a convenience method
that supports getting and setting individual image pixels by
[i][j]
coordinates. With no associated block,
view
returns an Image::View object. If the optional code
block is given, it will be passed the Image::View
object as an argument. The sync method will be called
automatically when the block terminates. In this case,
view
returns nil
.
If the optional code block is present, view
returns nil
. If it is not present,
view
returns an Image::View
object.
The example image below has been scaled 500% for clarity.
img = Image.new(40, 40) {self.background_color = 'lightcyan2'} # The view is 400 pixels square, starting at # column 10, row 5 from the top of the image. img.view( 10, 5, 20, 20) do |view| # Set all the pixels in the view to green. view[][] = Pixel.new(0, MaxRGB) # Change the top and bottom rows to red. view[0][] = 'red' view[-1,1][] = 'red' # Set 6 pixels to black. view[[13,15]][[12,14,16]] = 'black' # Set 1 pixel to yellow. view[5][7] = 'yellow' # Change the green channel of all the # pixels on row 8. view[8][].green = MaxRGB/2 # Change the blue channel of 8 pixels # on column 10. view[4,8][10].blue = MaxRGB end
pixel_color, get_pixels, store_pixels
The view
method introduces a relatively high
level of overhead to pixel manipulation compared to methods
that use the ×Magick API to identify and change pixels. I
recommend that you use view
only when the number
of pixels identified in the view is fairly small (a few
thousand to a few hundred thousand, depending on your patience
and the speed of your computer) and you need this degree of
control.
image.vignette(x, y, radius=0.0, sigma=10.0) -> anImage
Gradually shades the edges of the image by transforming the pixels into the background color.
A new image
VignetteImage (available in ImageMagick 6.2.6)
The image produced by vignette
is very similar
to the image produced by RMagick's vignette.rb example script.
However, the example script gives you more control over the
size, shape, and background color of the vignette.
image.watermark(mark, lightness=1.0,
saturation=1.0, x_offset=0, y_offset=0)
-> anImage
image.watermark(mark, lightness=1.0,
saturation=1.0, gravity, x_offset=0,
y_offset=0) -> anImage
Composites a watermark image on the target image using the Modulate composite operator. This composite operation operates in the HSL colorspace and combines part of the lightness, part of the saturation, and all of the hue of each pixel in the watermark with the corresponding pixel in the target image
Watermark can be called with a gravity argument or without. When a gravity argument is specified but the x- and y-offsets are omitted, the watermark is positioned based on the value of the gravity argument:
When the gravity argument is present and the x-offset (and optionally the y-offset) is present, the x- and y-offset are measured relative to the gravity value.
A new image
See "Watermarking with Images" in Anthony Thyssen's Examples of ImageMagick Usage.
image.wave(amplitude=25.0, wavelength=150.0) -> anImage
Creates a "ripple" effect in the image by shifting the pixels vertically along a sine wave whose amplitude and wavelength is specified by the given parameters.
A new image
WaveImage
image.wet_floor(initial=0.5, rate=1.0) -> anImage
Creates a "wet floor" reflection. The reflection is an inverted copy of the image that changes from partially transparent to entirely transparent. By default only the bottom third of the image appears in the reflection.
Note that the output image is just the reflection. This makes it easy to apply further transformations to the reflection before combining it with the original image.
A new image
Here are four examples of wet_floor
. The top
image shows the result of appending the default reflection to
the original image. The second image shows the result of
decreasing the initial transparency to 0.25 and using 0.5 as
the rate argument. The third image
uses the same reflection as the second image but has a slant
added. The bottom image is the same as the third image but with
a ripple effect.
image.white_threshold(red_channel [, green_channel[, blue_channel[, opacity_channel]]]) -> anImage
Forces all pixels above the threshold into white while leaving all pixels below 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
black_threshold, bilevel_channel
WhiteThresholdImage
image.write(filename) [ { optional arguments
} ] -> image
image.write(file) [ { optional arguments }
] -> image
Writes the image to the specified file. ×Magick determines image format from the prefix or extension.
If the argument is an open file, ×Magick will write the image in its current format. You can force a different format by setting the image's format attribute.
A file name or open file object. You may also specify optional arguments by setting Image::Info attributes in an associated block.
self
, or nil
if the image format
cannot be determined.
Almost all of the examples call write
.
WriteImage