Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

636 lines (455 sloc) 15.986 kb
<!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 December 2004), see www.w3.org" />
<title>RMagick 0.0.0: 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) 2006 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 0.0.0 User's Guide and Reference</h6>
<div class="nav">
&laquo;&nbsp;<a href="comtasks.html">Prev</a> | <a href=
"index.html">Contents</a> | <a href=
"ilist.html">Next</a>&nbsp;&raquo;
</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="#limit_resource">limit_resource</a></li>
<li><a href=
"#set_cache_threshold">set_cache_threshold</a></li>
<li><a href="#set_log_event_mask">set_log_event_mask</a></li>
<li><a href="#set_log_format">set_log_format</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>
-&gt; <em>Magick</em><br />
Magick.colors -&gt; <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> -&gt;
<em>Magick</em><br />
Magick.fonts -&gt; <em>anArray</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Lists the fonts that &times;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>
-&gt; <em>Magick</em><br />
Magick.formats -&gt; <em>aHash</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Describes the image formats supported by &times;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 &times;Magick can read the format, and "-"
otherwise.</td>
</tr>
<tr>
<td>W</td>
<td>is "w" if &times;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 &raquo;
{"TIF"=&gt;"*rw+",
"H"=&gt;"*rw-",
"MNG"=&gt;"*rw+",
"NULL"=&gt;"*rw-",
...
"G"=&gt;"*rw+",
"GIF"=&gt;"*rw+",
"PDB"=&gt;"*rw+"}
</pre>
<h4>Magick API</h4>
<p>GetMagickInfo</p>
<h4>Note</h4>
<p>&times;Magick depends on external programs for some formats.
Depending on how &times;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="limit_resource">limit_resource</h3>
<p>Magick.limit_resource(<span class="arg">resource_type</span>
[, <span class="arg">limit</span>]) -&gt; <span class=
"arg">old_limit</span></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Sets a limit to the amount of a resource, or gets the
current limit for the resource. <span class="imquote">When the
limit is reached, &times;Magick will fail in some fashion or
take compensating actions if possible.</span> The default
limits vary according to the platform. See the &times;Magick
documentation for the <em>-limit</em> option for more
information.</p>
<h4>Arguments</h4>This method may be called with one or two
arguments. The first argument identifies the resource. If
specified, the second argument is the limit.
<dl>
<dt>resource_type</dt>
<dd>One of the symbols <code>:disk</code>,
<code>:file</code>, <code>:map</code>, or
<code>:memory</code>. You may use a string instead of a
symbol.</dd>
<dt>limit</dt>
<dd>If present, the limit for the resource. This argument is
always an integer number. If the resource_type is
<code>:file</code>, the limit is the number of open files. If
<code>:memory</code> or <code>:map</code>, the limit is
measured megabytes. If <code>:disk</code>, the limit is
measured in gigabytes. If this argument is omitted the limit
is not changed.</dd>
</dl>
<h4>Returns</h4>
<p>The current resource limit. If a new limit is specified this
is the limit <em>before</em> the change.</p>
<h4>Notes</h4>
<p>This method supercedes <a href=
"#set_cache_threshold">set_cache_threshold</a>.</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>
<h4>Notes</h4>
<p>This method is obsolete. Use <a href=
"#limit_resource">limit_resource</a> instead. The code:</p>
<pre>
Magick.limit_resource(:memory, n)
Magick.limit_resource(:map, 2*n)
</pre>
<p>is equivalent to</p>
<pre>
Magick.set_cache_threshold(n)
</pre>
</div>
<div class="sig">
<h3 id="set_log_event_mask">set_log_event_mask</h3>
<p>Magick.set_log_event_mask(<span class=
"arg">event_list</span>)</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Specify which events to log.</p>
<h4>Argument</h4>
<p>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.</p>
<p><code>All, Annotate, Blob, Cache, Coder, Configure,
Deprecate, Draw, Exception, Locale, Module, None, Resource,
Trace, Transform, User, Wand, X11</code></p>
<h4>Example</h4>
<pre>
Magick.set_log_event_mask("Module,Coder")
</pre>
<h4>Magick API</h4>
<p>SetLogEventMask</p>
<h4>See also</h4>
<p><a href="#set_log_format">set_log_format</a></p>
<h4>Log configuration</h4>
<p>Magick logging is configured with the log.xml file in
Magick's config directory. See <a href=
"http://redux.imagemagick.org/script/resources.php">Resources</a>
in the ImageMagick documentation for more information.</p>
<p>Use this command to find out about the current log
configuration.</p>
<pre>
convert -list log
</pre>
</div>
<div class="sig">
<h3 id="set_log_format">set_log_format</h3>
<p>Magick.set_log_format(<span class="arg">format</span>)</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Specify the event log format.</p>
<h4>Argument</h4>
<p>A fprintf-like format string composed of optional "normal"
text (to which no meaning is assigned) and the following format
characters:</p>
<dl>
<dt>%d</dt>
<dd>domain</dd>
<dt>%e</dt>
<dd>event</dd>
<dt>%f</dt>
<dd>function</dd>
<dt>%l</dt>
<dd>line</dd>
<dt>%m</dt>
<dd>module</dd>
<dt>%p</dt>
<dd>process ID</dd>
<dt>%r</dt>
<dd>read CPU time</dd>
<dt>%t</dt>
<dd>wall clock time</dd>
<dt>%u</dt>
<dd>user CPU time</dd>
<dt>%%</dt>
<dd>percent sign</dd>
<dt>\n</dt>
<dd>newline</dd>
<dt>\r</dt>
<dd>carriage return</dd>
</dl>
</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">&nbsp;</p>
<div class="nav">
&laquo;&nbsp;<a href="comtasks.html">Prev</a> | <a href=
"index.html">Contents</a> | <a href=
"ilist.html">Next</a>&nbsp;&raquo;
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.