<- Prev | Contents | Next -> |
Table Of Contents |
|||||||||||||||||||||
module methods |
|||||||||||||||||||||
colors | Magick.colors { |color| block } ->
Magick Magick.colors -> anArray |
||||||||||||||||||||
Description |
Lists the named
colors. If the optional block is present, calls the
block once for each color, passing a Magick::Color
object. Otherwise, returns an array of Magick::Color
objects, one for each color.
The Magick::Color class is a Struct class with the following attributes:
|
||||||||||||||||||||
Arguments | None | ||||||||||||||||||||
Returns | If no block is associated with the call, returns an array of Magick::Color objects. | ||||||||||||||||||||
Example |
|
||||||||||||||||||||
×Magick API | GetColorInfo | ||||||||||||||||||||
fonts | Magick.fonts { |font| block } ->
Magick Magick.fonts -> anArray |
||||||||||||||||||||
Description |
Lists the fonts that ×Magick knows about. If the
optional block is present, calls the block once for each
font, passing a Magick::Font object. Otherwise, returns
an array of Magick::Font objects, one for each font.
The Magick::Font class is a Struct class with the following attributes:
|
||||||||||||||||||||
Arguments | None | ||||||||||||||||||||
Returns | If no block is associated with the call, returns an array of Magick::Font objects. | ||||||||||||||||||||
Example | fonts.rb | ||||||||||||||||||||
×Magick API | GetFontInfo | ||||||||||||||||||||
formats | Magick.formats { |f,v| block } ->
Magick Magick.formats -> aHash |
||||||||||||||||||||
Description | Describes the supported image formats (and therefore RMagick). If the optional block is present, calls the block once for each image format. The first argument, f, is the format name. The second argument, v, is the properties string described below. | ||||||||||||||||||||
Arguments | None | ||||||||||||||||||||
Returns |
A hash of image formats and their properties. Each key in
the returned hash is the name of a supported image
format. Each value is a string in the form "BRWA", where
|
||||||||||||||||||||
Example |
p Magick.formats » {"TIF"=>"*rw+", "H"=>"*rw-", "MNG"=>"*rw+", "NULL"=>"*rw-", ... "G"=>"*rw+", "GIF"=>"*rw+", "PDB"=>"*rw+"} |
||||||||||||||||||||
×Magick notes | http://www.imagemagick.org/www/formats.html | ||||||||||||||||||||
Advanced | ×Magick depends on external programs for some formats. Depending on how ×Magick was installed on your system, some formats may not be available. If you have questions, ask your system administrator. | ||||||||||||||||||||
set_cache_threshold | Magick.set_cache_threshold(n) | ||||||||||||||||||||
Description | Sets the amount of free memory allocated for the pixel cache. | ||||||||||||||||||||
Arguments | An integer number of megabytes. | ||||||||||||||||||||
Example |
# set the cache threshold to 10Mb Magick.set_cache_threshold(10) |
||||||||||||||||||||
×Magick notes | Once this threshold is exceeded, all subsequent pixels cache operations are to/from disk. | ||||||||||||||||||||
set_monitor | Magick.set_monitor(aProc) | ||||||||||||||||||||
Description |
Establish a monitor exit block. Some (see below) RMagick methods will call the monitor event block, passing parameters that describe how much work there is to be done and how much of that work has already been accomplished. There can be at most one monitor block defined at a time. To turn off monitoring, call Magick.set_monitor(nil). The argument is a block. The block should accept 3 arguments:
|
||||||||||||||||||||
Arguments | A Proc object. | ||||||||||||||||||||
Example |
#! /usr/local/bin/ruby -w require 'RMagick' img = Magick::Image.read("images/Cheetah.jpg").first monitor = Proc.new { |text, quantum, span| printf("%s %3.0f%% complete\n", text, ((quantum/span.to_f)*100.0)) } Magick.set_monitor(monitor) img.resize!(.50) exit produces: Resize image... 0% complete Resize image... 29% complete Resize image... 57% complete Resize image... 86% complete Resize image... 100% complete |
||||||||||||||||||||
×Magick notes | The list of methods which call the monitor block is difficult to determine. The only sure way to find out is to read the source code. In the Image class the list includes add_noise, blur_image, channel, chop, colorize, crop, colors, despeckle, enhance, equalize, flip, flop, frame, gamma_correct, implode, level, magnify, median_filter, minify, modulate, morph, negate, normalize, oil_paint, opaque, raise, reduce_noise, resize, roll, rotate, sample, scale, segment, shade, sharpen, shear, solarize, spread, stegano, stereo, swirl, texture threshold, transparent, and wave. In the ImageList class, the list includes append, average, and montage. |
<- Prev | Contents | Next -> |