# module Magick

### Table Of Contents

- colors
- fonts
- formats
- set_cache_threshold

## module methods

colors | Magick.colors { |color| block } -> Magick Magick.colors -> anArray

Description

Lists the named colors that ImageMagick knows about. If the optional block is present, runs 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.

Arguments | None
Returns | If no block is associated with the call, returns an array of Magick::Color objects.

Example

This is a small sample of `colors.miff`, the complete image created by the example program. .

ImageMagick API | GetColorInfo
Advanced | It is possible, under some conditions, for the block to be called more than once for the same color. The array returned by colors, however, will contain exactly one element for each color.
fonts | Magick.fonts { |font| block } -> Magick Magick.fonts -> anArray

Description

Lists the fonts that ImageMagick knows about. If the optional block is present, runs 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`.

Arguments | None
Returns | If no block is associated with the call, returns an array of Magick::Font objects.
Example | fonts.rb
ImageMagick API | GetFontInfo
formats | Magick.formats { |f,v| block } -> Magick Magick.formats -> aHash
Description | Describes the image formats supported by ImageMagick (and therefore RMagick). If the optional block is present, runs 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 ImageMagick image formats and their properties. Each key in the returned hash is the name of a supported ImageMagick image format. Each value is a string in the form "BRWA", where

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.

Example

    p Magick.formats »
       {"TIF"=>"*rw+",
       "H"=>"*rw-",
       "MNG"=>"*rw+",
       "NULL"=>"*rw-",
       ...
       "G"=>"*rw+",
       "GIF"=>"*rw+",
       "PDB"=>"*rw+"}

ImageMagick notes | file:///usr/local/share/doc/ImageMagick/www/formats.html
Advanced | 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.
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)

ImageMagick notes | Once this threshold is exceeded, all subsequent pixels cache operations are to/from disk.