<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" /> <title>RMagick: module Magick</title> <meta http-equiv="Content-Type" content= "text/html; charset=us-ascii" /> <meta name="GENERATOR" content="Quanta Plus" /> <meta name="Copyright" content= "Copyright (C) 2005 by Timothy P. Hunter" /> <link rel="stylesheet" type="text/css" href="css/doc.css" /> <script type="text/javascript" src="scripts/doc.js"> </script> <style type="text/css"> /*<![CDATA[*/ /* Styles local to this page. */ /*]]>*/ </style> </head> <body> <h6 id="header">RMagick User's Guide and Reference</h6> <div class="nav"> « <a href="comtasks.html">Prev</a> | <a href= "index.html">Contents</a> | <a href= "ilist.html">Next</a> » </div> <h1>module Magick</h1> <div id="toc"> <h2>Table of Contents</h2> <h3>module methods</h3> <ul> <li><a href="#colors">colors</a></li> <li><a href="#fonts">fonts</a></li> <li><a href="#formats">formats</a></li> <li><a href= "#set_cache_threshold">set_cache_threshold</a></li> <li><a href="#set_monitor">set_monitor</a></li> </ul> </div> <h2 class="methods">module methods</h2> <div class="sig"> <h3 id="colors">colors</h3> <p>Magick.colors <span class="arg">{ |color| block }</span> -> <em>Magick</em><br /> Magick.colors -> <em>anArray</em></p> </div> <div class="desc"> <h4>Description</h4> <p>Lists the <a href="imusage.html#color_names">named colors</a>. 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.</p> <p>The Magick::Color class is a Struct class with the following attributes:</p> <table class="simple_table" summary="magic color attributes"> <caption> Magick::Color attributes </caption> <tr> <th>Attribute</th> <th>Value</th> </tr> <tr> <td>name</td> <td>The color name. For example, "red".</td> </tr> <tr> <td>compliance</td> <td>A <a href= "constants.html#ComplianceType">ComplianceType</a> value such as X11Compliance.</td> </tr> <tr> <td>color</td> <td>A <a href="struct.html#Pixel">Pixel</a> object containing the RGB values.</td> </tr> </table> <h4>Returns</h4> <p>If no block is associated with the call, returns an array of Magick::Color objects.</p> <h4>Example</h4> <p>This is a small sample of <code>colors.miff</code>, the complete image created by the example program.</p> <p><a href="javascript:popup('colors.rb.html')"><img src= "ex/colors.gif" title="Click to see the example script" alt= "Magick::colors example" /></a></p> <h4>Magick API</h4> <p>GetColorInfo</p> </div> <div class="sig"> <h3 id="fonts">fonts</h3> <p>Magick.fonts <span class="arg">{ |font| block }</span> -> <em>Magick</em><br /> Magick.fonts -> <em>anArray</em></p> </div> <div class="desc"> <h4>Description</h4> <p>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.</p> <p>The Magick::Font class is a Struct class with the following attributes:</p> <table summary="font class attributes" class="simple_table"> <caption> Magick::Font attributes </caption> <tr> <th>Attribute</th> <th>Value</th> </tr> <tr> <td>name</td> <td>The font name. For example, "Palatino-Roman".</td> </tr> <tr> <td>description</td> <td>The font description. For example, "Palatino Roman".</td> </tr> <tr> <td>family</td> <td>The font family. For example, "Palatino", "Helvetica", or "Courier".</td> </tr> <tr> <td>style</td> <td>A <a href="constants.html#StyleType">StyleType</a> value such as <code>NormalStyle</code>.</td> </tr> <tr> <td>stretch</td> <td>A <a href="constants.html#StretchType">StretchType</a> value such as <code>NormalStretch</code>.</td> </tr> <tr> <td>weight</td> <td>The font weight, one of 100, 200, 300, 400, 500, 600, 700, 800, or 900.</td> </tr> <tr> <td>encoding</td> <td>The font encoding, such as "AppleRoman". May be <code>nil</code>.</td> </tr> <tr> <td>foundry</td> <td>The font foundry. "URW", for example. May be <code>nil</code>.</td> </tr> <tr> <td>format</td> <td>If the font is a Type1 font, has the value "type1", otherwise <code>nil</code>.</td> </tr> </table> <h4>Returns</h4> <p>If no block is associated with the call, returns an array of Magick::Font objects.</p> <h4>Example</h4> <p><a href="javscript:popup('fonts.rb.html')" title= "The example script">fonts.rb</a></p> <h4>Magick API</h4> <p>GetFontInfo</p> </div> <div class="sig"> <h3 id="formats">formats</h3> <p>Magick.formats <span class="arg">{ |f,v| block }</span> -> <em>Magick</em><br /> Magick.formats -> <em>aHash</em></p> </div> <div class="desc"> <h4>Description</h4> <p>Describes the image formats supported by ×Magick. If the optional block is present, calls the block once for each image format. The first argument, <em>f</em>, is the format name. The second argument, <em>v</em>, is the properties string described below.</p> <h4>Returns</h4>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". The details are in this table: <table summary="format string symbols" class="simple_table"> <caption> Format property codes </caption> <tr> <th>Code</th> <th>Definition</th> </tr> <tr> <td>B</td> <td>is "*" if the format has native blob support, and "-" otherwise.</td> </tr> <tr> <td>R</td> <td>is "r" if ×Magick can read the format, and "-" otherwise.</td> </tr> <tr> <td>W</td> <td>is "w" if ×Magick can write the format, and "-" otherwise.</td> </tr> <tr> <td>A</td> <td>is "+" if the format supports multi-image files, and "-" otherwise.</td> </tr> </table> <h4>Example</h4> <pre> p Magick.formats » {"TIF"=>"*rw+", "H"=>"*rw-", "MNG"=>"*rw+", "NULL"=>"*rw-", ... "G"=>"*rw+", "GIF"=>"*rw+", "PDB"=>"*rw+"} </pre> <h4>Magick API</h4> <p>GetMagickInfo</p> <h4>Note</h4> <p>×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.</p> </div> <div class="sig"> <h3 id="set_cache_threshold">set_cache_threshold</h3> <p>Magick.set_cache_threshold(<span class="arg">n</span>)</p> </div> <div class="desc"> <h4>Description</h4> <p>Sets the amount of free memory allocated for the pixel cache. <span class="imquote">Once this threshold is exceeded, all subsequent pixels cache operations are to/from disk.</span></p> <h4>Arguments</h4> <p>An integer number of megabytes.</p> <h4>Example</h4> <pre> # set the cache threshold to 10Mb Magick.set_cache_threshold(10) </pre> </div> <div class="sig"> <h3 id="set_monitor">set_monitor</h3> <p>Magick.set_monitor(<span class="arg">aProc</span>)</p> </div> <div class="desc"> <h4>Description</h4> <p><strong>Note:</strong> <em>This method is deprecated with ImageMagick 6.1.0 and later versions. Use <a href= "imageattrs.html#monitor">Image#monitor=</a> and <a href= "info.html#monitor">Image::Info#monitor=</a> instead.</em></p> <p>Establish a monitor exit block. Some (see <a href= "#monitor_notes">below</a>) 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.</p> <p>There can be at most one monitor block defined at a time. To turn off monitoring, call <code>Magick.set_monitor(nil)</code>.</p> <h4>Arguments</h4> <p>The argument is a <code>Proc</code> object. The Proc should accept 3 arguments:</p> <dl> <dt>text</dt> <dd>a String that describes the operation being monitored.</dd> <dt>quantum</dt> <dd>a value between 0 and <code>span</code> that represents the number of events that have been performed, images that have been processed, etc.</dd> <dt>span</dt> <dd>The total number of events to be performed, images to be processed, etc.</dd> </dl> <h4>Example</h4> <pre> monitor = Proc.new { |text, quantum, span| printf("%s %3.0f%% complete\n", text, ((quantum/span.to_f)*100.0)) } Magick.set_monitor(monitor) </pre> <h4>Magick API</h4> <p>SetMonitorHandler</p> <h4 id="monitor_notes">Note</h4> <p>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 <code>add_noise</code>, <code>blur_image</code>, <code>channel</code>, <code>chop</code>, <code>colorize</code>, <code>crop</code>, <code>colors</code>, <code>despeckle</code>, <code>enhance</code>, <code>equalize</code>, <code>flip</code>, <code>flop</code>, <code>frame</code>, <code>gamma_correct</code>, <code>implode</code>, <code>level</code>, <code>magnify</code>, <code>median_filter</code>, <code>minify</code>, <code>modulate</code>, <code>morph</code>, <code>negate</code>, <code>normalize</code>, <code>oil_paint</code>, <code>opaque</code>, <code>raise</code>, <code>reduce_noise</code>, <code>resize</code>, <code>roll</code>, <code>rotate</code>, <code>sample</code>, <code>scale</code>, <code>segment</code>, <code>shade</code>, <code>sharpen</code>, <code>shear</code>, <code>solarize</code>, <code>spread</code>, <code>stegano</code>, <code>stereo</code>, <code>swirl</code>, <code>texture</code> <code>threshold</code>, <code>transparent</code>, and <code>wave</code>. In the ImageList class, the list includes <code>append</code>, <code>average</code>, and <code>montage</code>.</p> </div> <p class="spacer"> </p> <div class="nav"> « <a href="comtasks.html">Prev</a> | <a href= "index.html">Contents</a> | <a href= "ilist.html">Next</a> » </div> </body> </html>