Magick.colors { |color| block } -> Magick
Magick.colors -> array
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:
| Attribute | Value |
|---|---|
| name | The color name. For example, "red". |
| compliance | A ComplianceType value such as X11Compliance. |
| color | A Pixel object containing the RGB values. |
If no block is associated with the call, returns an array of Magick::Color objects.
This is a small sample of colors.miff, the complete image created by the example program.
GetColorInfo
Magick.fonts { |font| block } -> Magick
Magick.fonts -> array
Lists the fonts that ImageMagick 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:
| Attribute | Value |
|---|---|
| name | The font name. For example, "Palatino-Roman". |
| description | The font description. For example, "Palatino Roman". |
| family | The font family. For example, "Palatino", "Helvetica", or "Courier". |
| style | A StyleType value such as NormalStyle. |
| stretch | A StretchType value such as NormalStretch. |
| weight | The font weight, one of 100, 200, 300, 400, 500, 600, 700, 800, or 900. |
| encoding | The font encoding, such as "AppleRoman". May be nil. |
| foundry | The font foundry. "URW", for example. May be nil. |
| format |
If the font is a Type1 font, has the value "type1", otherwise
nil.
|
If no block is associated with the call, returns an array of Magick::Font objects.
GetFontInfo
Magick.formats { |f,v| block } -> Magick
Magick.formats -> hash
Describes the image formats supported by ImageMagick. 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.
| Code | Definition |
|---|---|
| B | is "*" if the format has native blob support, and "-" otherwise. |
| R | is "r" if ImageMagick can read the format, and "-" otherwise. |
| W | is "w" if ImageMagick can write the format, and "-" otherwise. |
| A | is "+" if the format supports multi-image files, and "-" otherwise. |
p Magick.formats
#=> {"TIF"=>"*rw+",
# "H"=>"*rw-",
# "MNG"=>"*rw+",
# "NULL"=>"*rw-",
# ...
# "G"=>"*rw+",
# "GIF"=>"*rw+",
# "PDB"=>"*rw+"}
GetMagickInfo
ImageMagick depends on external programs for some formats. Depending on how ImageMagick was installed on your system, some formats may not be available. If you have questions, ask your system administrator.
Magick.limit_resource(resource_type [, limit]) -> old_limit
Sets a limit to the amount of a resource, or gets the current limit for the resource. When the limit is reached, ImageMagick will fail in some fashion or take compensating actions if possible. The default limits vary according to the platform. See the ImageMagick documentation for the -limit option for more information.
:area, :disk, :file, :map, :memory, or :time. You may
use a string instead of a symbol.
:file, the limit is the number of open files. If :memory, :map or :disk, the limit is measured in
bytes. If the resource_type is :area the limit is the maximum
width * height of an image in pixels that can reside in pixel cache memory. If :time, the limit is measured in seconds. If this argument
is omitted the limit is not changed.
The current resource limit. If a new limit is specified this is the limit before the change.
This method supersedes set_cache_threshold.
Setting the :time limit resets the elapsed time to zero in the pixel cache. Call it before any operation that you need to set a time limit
on.
Magick.resource_usage(resource_type) -> integer
Gets the amount of a resource that ImageMagick is using now. The :memory, :map and :disk resources are in bytes.
Most of them are the pixel caches of all images held in memory, in memory-mapped files and on disk, including those of Image objects that are no longer
referenced but have not been garbage collected yet, which ObjectSpace cannot see. ImageMagick also counts blobs that it maps into memory
and a few internal buffers, but not other memory it allocates.
:area, :disk, :file, :map, :memory, or :time. You may
use a string instead of a symbol.
The amount of the resource in use.
image = Magick::Image.new(1000, 1000) p Magick.resource_usage(:memory) #=> 12000000 (with Q16 HDRI, 3 channels of 4 bytes per pixel) # Collect unreferenced images once their pixel caches reach 1GB GC.start if Magick.resource_usage(:memory) > 1024**3
The :area resource is the width * height of the last pixel cache that ImageMagick checked against its limit, not a total.
GetMagickResource
Magick.set_cache_threshold(threshold)
Set the amount of free memory allocated for the pixel cache. Once this threshold is exceeded, all subsequent pixel cache operations are to/from disk.
A number of megabytes to set.
Magick.set_log_event_mask(event_list)
Specify which events to log.
A string composed of one or more of the following event types. If more than one event type is specified, separate the event types with commas.
All, Annotate, Blob, Cache, Coder, Configure, Deprecate, Draw, Exception, Locale, Module, None, Resource, Trace, Transform, User, Wand, X11
Magick.set_log_event_mask("Module,Coder")
SetLogEventMask
Magick logging is configured with the log.xml file in Magick's config directory. See Resources in the ImageMagick documentation for more information.
Use this command to find out about the current log configuration.
convert -list log
Magick.set_log_format(format)
Specify the event log format.
A fprintf-like format string composed of optional "normal" text (to which no meaning is assigned) and the following format characters: