rmagick 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- data/ChangeLog +232 -0
- data/Makefile.in +28 -0
- data/README.html +404 -0
- data/README.txt +397 -0
- data/configure +8554 -0
- data/configure.ac +497 -0
- data/doc/comtasks.html +241 -0
- data/doc/constants.html +1195 -0
- data/doc/css/doc.css +299 -0
- data/doc/css/popup.css +34 -0
- data/doc/draw.html +3108 -0
- data/doc/ex/Adispatch.rb +43 -0
- data/doc/ex/Zconstitute.rb +9 -0
- data/doc/ex/adaptive_threshold.rb +19 -0
- data/doc/ex/add_noise.rb +18 -0
- data/doc/ex/affine.rb +48 -0
- data/doc/ex/affine_transform.rb +20 -0
- data/doc/ex/arc.rb +47 -0
- data/doc/ex/arcpath.rb +33 -0
- data/doc/ex/average.rb +15 -0
- data/doc/ex/axes.rb +64 -0
- data/doc/ex/bilevel_channel.rb +20 -0
- data/doc/ex/blur_image.rb +12 -0
- data/doc/ex/border.rb +10 -0
- data/doc/ex/bounding_box.rb +48 -0
- data/doc/ex/cbezier1.rb +40 -0
- data/doc/ex/cbezier2.rb +40 -0
- data/doc/ex/cbezier3.rb +40 -0
- data/doc/ex/cbezier4.rb +41 -0
- data/doc/ex/cbezier5.rb +41 -0
- data/doc/ex/cbezier6.rb +51 -0
- data/doc/ex/channel.rb +26 -0
- data/doc/ex/channel_threshold.rb +48 -0
- data/doc/ex/charcoal.rb +12 -0
- data/doc/ex/chop.rb +29 -0
- data/doc/ex/circle.rb +31 -0
- data/doc/ex/clip_path.rb +56 -0
- data/doc/ex/coalesce.rb +60 -0
- data/doc/ex/color_fill_to_border.rb +29 -0
- data/doc/ex/color_floodfill.rb +28 -0
- data/doc/ex/color_histogram.rb +60 -0
- data/doc/ex/color_reset.rb +11 -0
- data/doc/ex/colorize.rb +16 -0
- data/doc/ex/colors.rb +65 -0
- data/doc/ex/composite.rb +135 -0
- data/doc/ex/contrast.rb +37 -0
- data/doc/ex/crop.rb +31 -0
- data/doc/ex/crop_with_gravity.rb +46 -0
- data/doc/ex/cycle_colormap.rb +21 -0
- data/doc/ex/demo.rb +324 -0
- data/doc/ex/drawcomp.rb +42 -0
- data/doc/ex/drop_shadow.rb +60 -0
- data/doc/ex/edge.rb +11 -0
- data/doc/ex/ellipse.rb +43 -0
- data/doc/ex/emboss.rb +11 -0
- data/doc/ex/enhance.rb +28 -0
- data/doc/ex/equalize.rb +11 -0
- data/doc/ex/flatten_images.rb +38 -0
- data/doc/ex/flip.rb +11 -0
- data/doc/ex/flop.rb +11 -0
- data/doc/ex/fonts.rb +20 -0
- data/doc/ex/frame.rb +12 -0
- data/doc/ex/gaussian_blur.rb +11 -0
- data/doc/ex/get_multiline_type_metrics.rb +53 -0
- data/doc/ex/get_pixels.rb +48 -0
- data/doc/ex/get_type_metrics.rb +140 -0
- data/doc/ex/gradientfill.rb +27 -0
- data/doc/ex/grav.rb +44 -0
- data/doc/ex/gravity.rb +80 -0
- data/doc/ex/hatchfill.rb +27 -0
- data/doc/ex/images/Ballerina.jpg +0 -0
- data/doc/ex/images/Ballerina3.jpg +0 -0
- data/doc/ex/images/Button_0.gif +0 -0
- data/doc/ex/images/Button_1.gif +0 -0
- data/doc/ex/images/Button_2.gif +0 -0
- data/doc/ex/images/Button_3.gif +0 -0
- data/doc/ex/images/Button_4.gif +0 -0
- data/doc/ex/images/Button_5.gif +0 -0
- data/doc/ex/images/Button_6.gif +0 -0
- data/doc/ex/images/Button_7.gif +0 -0
- data/doc/ex/images/Button_8.gif +0 -0
- data/doc/ex/images/Button_9.gif +0 -0
- data/doc/ex/images/Button_A.gif +0 -0
- data/doc/ex/images/Button_B.gif +0 -0
- data/doc/ex/images/Button_C.gif +0 -0
- data/doc/ex/images/Button_D.gif +0 -0
- data/doc/ex/images/Button_E.gif +0 -0
- data/doc/ex/images/Button_F.gif +0 -0
- data/doc/ex/images/Button_G.gif +0 -0
- data/doc/ex/images/Button_H.gif +0 -0
- data/doc/ex/images/Button_I.gif +0 -0
- data/doc/ex/images/Button_J.gif +0 -0
- data/doc/ex/images/Button_K.gif +0 -0
- data/doc/ex/images/Button_L.gif +0 -0
- data/doc/ex/images/Button_M.gif +0 -0
- data/doc/ex/images/Button_N.gif +0 -0
- data/doc/ex/images/Button_O.gif +0 -0
- data/doc/ex/images/Button_P.gif +0 -0
- data/doc/ex/images/Button_Q.gif +0 -0
- data/doc/ex/images/Button_R.gif +0 -0
- data/doc/ex/images/Button_S.gif +0 -0
- data/doc/ex/images/Button_T.gif +0 -0
- data/doc/ex/images/Button_U.gif +0 -0
- data/doc/ex/images/Button_V.gif +0 -0
- data/doc/ex/images/Button_W.gif +0 -0
- data/doc/ex/images/Button_X.gif +0 -0
- data/doc/ex/images/Button_Y.gif +0 -0
- data/doc/ex/images/Button_Z.gif +0 -0
- data/doc/ex/images/Cheetah.jpg +0 -0
- data/doc/ex/images/Coffee.wmf +0 -0
- data/doc/ex/images/Flower_Hat.jpg +0 -0
- data/doc/ex/images/Gold_Statue.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
- data/doc/ex/images/No.wmf +0 -0
- data/doc/ex/images/Polynesia.jpg +0 -0
- data/doc/ex/images/Red_Rocks.jpg +0 -0
- data/doc/ex/images/Shorts.jpg +0 -0
- data/doc/ex/images/Snake.wmf +0 -0
- data/doc/ex/images/Violin.jpg +0 -0
- data/doc/ex/images/graydient230x6.gif +0 -0
- data/doc/ex/images/logo400x83.gif +0 -0
- data/doc/ex/images/model.miff +0 -0
- data/doc/ex/images/notimplemented.gif +0 -0
- data/doc/ex/images/smile.miff +0 -0
- data/doc/ex/images/spin.gif +0 -0
- data/doc/ex/implode.rb +32 -0
- data/doc/ex/level.rb +12 -0
- data/doc/ex/level_channel.rb +33 -0
- data/doc/ex/line.rb +40 -0
- data/doc/ex/map.rb +28 -0
- data/doc/ex/map_f.rb +15 -0
- data/doc/ex/matte_fill_to_border.rb +42 -0
- data/doc/ex/matte_floodfill.rb +35 -0
- data/doc/ex/matte_replace.rb +42 -0
- data/doc/ex/median_filter.rb +28 -0
- data/doc/ex/modulate.rb +11 -0
- data/doc/ex/mono.rb +23 -0
- data/doc/ex/morph.rb +26 -0
- data/doc/ex/mosaic.rb +35 -0
- data/doc/ex/motion_blur.rb +11 -0
- data/doc/ex/negate.rb +11 -0
- data/doc/ex/negate_channel.rb +19 -0
- data/doc/ex/normalize.rb +11 -0
- data/doc/ex/oil_paint.rb +11 -0
- data/doc/ex/opacity.rb +38 -0
- data/doc/ex/opaque.rb +14 -0
- data/doc/ex/ordered_dither.rb +11 -0
- data/doc/ex/path.rb +62 -0
- data/doc/ex/pattern1.rb +25 -0
- data/doc/ex/pattern2.rb +26 -0
- data/doc/ex/polygon.rb +24 -0
- data/doc/ex/polyline.rb +23 -0
- data/doc/ex/posterize.rb +19 -0
- data/doc/ex/preview.rb +16 -0
- data/doc/ex/qbezierpath.rb +49 -0
- data/doc/ex/quantize-m.rb +25 -0
- data/doc/ex/radial_blur.rb +19 -0
- data/doc/ex/raise.rb +11 -0
- data/doc/ex/random_channel_threshold.rb +17 -0
- data/doc/ex/random_threshold_channel.rb +18 -0
- data/doc/ex/rectangle.rb +33 -0
- data/doc/ex/reduce_noise.rb +28 -0
- data/doc/ex/roll.rb +9 -0
- data/doc/ex/rotate.rb +43 -0
- data/doc/ex/rotate_f.rb +14 -0
- data/doc/ex/roundrect.rb +32 -0
- data/doc/ex/rubyname.rb +31 -0
- data/doc/ex/segment.rb +11 -0
- data/doc/ex/shade.rb +11 -0
- data/doc/ex/shave.rb +15 -0
- data/doc/ex/shear.rb +10 -0
- data/doc/ex/skewx.rb +50 -0
- data/doc/ex/skewy.rb +45 -0
- data/doc/ex/smile.rb +124 -0
- data/doc/ex/solarize.rb +11 -0
- data/doc/ex/splice.rb +16 -0
- data/doc/ex/spread.rb +11 -0
- data/doc/ex/stegano.rb +50 -0
- data/doc/ex/stroke_dasharray.rb +41 -0
- data/doc/ex/stroke_linecap.rb +44 -0
- data/doc/ex/stroke_linejoin.rb +48 -0
- data/doc/ex/stroke_width.rb +47 -0
- data/doc/ex/swirl.rb +17 -0
- data/doc/ex/text.rb +32 -0
- data/doc/ex/text_align.rb +36 -0
- data/doc/ex/text_antialias.rb +33 -0
- data/doc/ex/text_undercolor.rb +26 -0
- data/doc/ex/texture_fill_to_border.rb +34 -0
- data/doc/ex/texture_floodfill.rb +31 -0
- data/doc/ex/texturefill.rb +25 -0
- data/doc/ex/threshold.rb +13 -0
- data/doc/ex/to_blob.rb +14 -0
- data/doc/ex/translate.rb +37 -0
- data/doc/ex/transparent.rb +38 -0
- data/doc/ex/trim.rb +25 -0
- data/doc/ex/unsharp_mask.rb +28 -0
- data/doc/ex/viewex.rb +36 -0
- data/doc/ex/wave.rb +9 -0
- data/doc/ilist.html +1592 -0
- data/doc/image1.html +3009 -0
- data/doc/image2.html +2169 -0
- data/doc/image3.html +2815 -0
- data/doc/imageattrs.html +1319 -0
- data/doc/imusage.html +403 -0
- data/doc/index.html +418 -0
- data/doc/info.html +949 -0
- data/doc/magick.html +439 -0
- data/doc/scripts/doc.js +9 -0
- data/doc/struct.html +1334 -0
- data/doc/usage.html +1318 -0
- data/examples/describe.rb +44 -0
- data/examples/histogram.rb +289 -0
- data/examples/image_opacity.rb +29 -0
- data/examples/import_export.rb +31 -0
- data/examples/pattern_fill.rb +38 -0
- data/examples/rotating_text.rb +47 -0
- data/examples/thumbnail.rb +65 -0
- data/examples/vignette.rb +79 -0
- data/ext/RMagick/MANIFEST +239 -0
- data/ext/RMagick/extconf.rb.in +21 -0
- data/ext/RMagick/rmagick.h +938 -0
- data/ext/RMagick/rmagick_config.h.in +170 -0
- data/ext/RMagick/rmdraw.c +1308 -0
- data/ext/RMagick/rmfill.c +609 -0
- data/ext/RMagick/rmilist.c +685 -0
- data/ext/RMagick/rmimage.c +7980 -0
- data/ext/RMagick/rminfo.c +982 -0
- data/ext/RMagick/rmmain.c +1497 -0
- data/ext/RMagick/rmutil.c +2685 -0
- data/install.rb +1015 -0
- data/lib/RMagick.rb +1486 -0
- data/metaconfig.in +6 -0
- data/post-clean.rb +12 -0
- data/post-install.rb +36 -0
- data/post-setup.rb +245 -0
- data/rmagick.gemspec +22 -0
- data/uninstall.rb +71 -0
- metadata +286 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
|
4
|
+
# Demonstrate the Image#transparent method.
|
5
|
+
# Change all black pixels in the image to transparent.
|
6
|
+
|
7
|
+
before = Magick::Image.new(200,200) {
|
8
|
+
self.background_color = 'black'
|
9
|
+
}
|
10
|
+
|
11
|
+
circle = Magick::Draw.new
|
12
|
+
circle.fill('transparent')
|
13
|
+
circle.stroke('white')
|
14
|
+
circle.stroke_width(8)
|
15
|
+
circle.circle(100,100,180,100)
|
16
|
+
circle.fill('transparent')
|
17
|
+
circle.stroke('white')
|
18
|
+
circle.circle( 60,100, 40,100)
|
19
|
+
circle.circle(140,100,120,100)
|
20
|
+
circle.circle(100, 60,100, 40)
|
21
|
+
circle.circle(100,140,100,120)
|
22
|
+
circle.draw(before)
|
23
|
+
|
24
|
+
before.compression = Magick::LZWCompression
|
25
|
+
before.write('transparent_before.gif')
|
26
|
+
|
27
|
+
before.fuzz = 100
|
28
|
+
after = before.transparent('black', Magick::TransparentOpacity)
|
29
|
+
|
30
|
+
# Different way of reading an image - start with an imagelist.
|
31
|
+
# Use the plasma image as a background so we can see that
|
32
|
+
# the black pixels have been made transparent.
|
33
|
+
bg = Magick::ImageList.new
|
34
|
+
bg.read('plasma:purple-gold') { self.size = '200x200' }
|
35
|
+
|
36
|
+
after = bg.composite(after, Magick::CenterGravity, Magick::OverCompositeOp)
|
37
|
+
after.write('transparent_after.gif')
|
38
|
+
exit
|
data/doc/ex/trim.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'RMagick'
|
2
|
+
include Magick
|
3
|
+
|
4
|
+
# Demonstrate the trim method
|
5
|
+
|
6
|
+
# Read the Flower_Hat image and reduce it to 80% of its original size.
|
7
|
+
img = Image.read('images/Flower_Hat.jpg').first
|
8
|
+
cols = img.columns
|
9
|
+
rows = img.rows
|
10
|
+
img.resize!(0.80)
|
11
|
+
|
12
|
+
# Add a gray border to bring it back up to size
|
13
|
+
before = img.border((cols-img.columns)/2, (rows-img.rows)/2, '#999')
|
14
|
+
|
15
|
+
# Trim away the gray border
|
16
|
+
after = before.trim
|
17
|
+
|
18
|
+
# Add a white border to bring it back up to size
|
19
|
+
after.border!((cols-img.columns)/2, (rows-img.rows)/2, 'white')
|
20
|
+
|
21
|
+
# Need GIF for tranparency
|
22
|
+
before.write('trim_before.jpg')
|
23
|
+
after.write('trim_after.jpg')
|
24
|
+
exit
|
25
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
|
4
|
+
# Demonstrate the Image#enhance method
|
5
|
+
|
6
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
|
+
|
8
|
+
eimg = img.unsharp_mask(3.0, 1.0, 1.0, 0.05)
|
9
|
+
|
10
|
+
img.resize!(3)
|
11
|
+
eimg.resize!(3)
|
12
|
+
|
13
|
+
# Make a before-and-after composite
|
14
|
+
eimg.crop!(eimg.columns/2, 0, eimg.columns/2, eimg.rows)
|
15
|
+
img = img.composite(eimg, Magick::EastGravity, Magick::OverCompositeOp)
|
16
|
+
|
17
|
+
# Draw a black line between the before and after parts.
|
18
|
+
line = Magick::Draw.new
|
19
|
+
line.line(img.columns/2, 0, img.columns/2, img.rows)
|
20
|
+
line.draw(img)
|
21
|
+
|
22
|
+
# Zoom in so we can see the change,
|
23
|
+
# then crop everything but the face.
|
24
|
+
img.crop!(Magick::CenterGravity, 250, 200)
|
25
|
+
|
26
|
+
#img.display
|
27
|
+
img.write('unsharp_mask.jpg')
|
28
|
+
exit
|
data/doc/ex/viewex.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
|
3
|
+
require 'RMagick'
|
4
|
+
include Magick
|
5
|
+
|
6
|
+
img = Image.new(40, 40) {self.background_color = 'lightcyan2'}
|
7
|
+
|
8
|
+
# The view is 400 pixels square, starting
|
9
|
+
# column 10, row 5 from the top of the image.
|
10
|
+
img.view( 10, 5, 20, 20) do |view|
|
11
|
+
|
12
|
+
# Set all the pixels in the view to green.
|
13
|
+
view[][] = Pixel.new(0, MaxRGB)
|
14
|
+
|
15
|
+
# Change the top and bottom rows to red.
|
16
|
+
view[0][] = 'red'
|
17
|
+
view[-1,1][] = 'red'
|
18
|
+
|
19
|
+
# Set 6 pixels to black.
|
20
|
+
view[[13,15]][[12,14,16]] = 'black'
|
21
|
+
|
22
|
+
# Set 1 pixel to yellow.
|
23
|
+
view[5][7] = 'yellow'
|
24
|
+
|
25
|
+
# Change the green channel of all the
|
26
|
+
# pixels on row 8.
|
27
|
+
view[8][].green = MaxRGB/2
|
28
|
+
|
29
|
+
# Change the blue channel of 8 pixels
|
30
|
+
# on column 10.
|
31
|
+
view[4,8][10].blue = MaxRGB
|
32
|
+
end
|
33
|
+
|
34
|
+
img.scale(5).write("viewex.gif")
|
35
|
+
exit
|
36
|
+
|
data/doc/ex/wave.rb
ADDED
data/doc/ilist.html
ADDED
@@ -0,0 +1,1592 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
|
+
<head>
|
6
|
+
<meta name="generator" content=
|
7
|
+
"HTML Tidy for Linux/x86 (vers 1st September 2004), see www.w3.org" />
|
8
|
+
|
9
|
+
<title>RMagick: class ImageList</title>
|
10
|
+
<meta http-equiv="Content-Type" content=
|
11
|
+
"text/html; charset=us-ascii" />
|
12
|
+
<meta name="GENERATOR" content="Quanta Plus" />
|
13
|
+
<meta name="Copyright" content=
|
14
|
+
"Copyright (C) 2004 by Timothy P. Hunter" />
|
15
|
+
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
16
|
+
<script type="text/javascript" src="scripts/doc.js">
|
17
|
+
</script>
|
18
|
+
<script type="text/javascript">
|
19
|
+
//<![CDATA[
|
20
|
+
<!-- Pre-load these images -->
|
21
|
+
img = new Image();
|
22
|
+
img.src = "ex/average_before.gif";
|
23
|
+
img.src = "ex/coalesce_anim.gif";
|
24
|
+
img.src = "ex/map_before.jpg";
|
25
|
+
img.src = "ex/morph.gif";
|
26
|
+
img.src = "ex/quantize-m_before.jpg";
|
27
|
+
//]]>
|
28
|
+
</script>
|
29
|
+
<style type="text/css">
|
30
|
+
/*<![CDATA[*/
|
31
|
+
|
32
|
+
/* Styles local to this page. */
|
33
|
+
/*]]>*/
|
34
|
+
</style>
|
35
|
+
</head>
|
36
|
+
|
37
|
+
<body>
|
38
|
+
<h6 id="header">RMagick User's Guide and Reference</h6>
|
39
|
+
|
40
|
+
<div class="nav">
|
41
|
+
« <a href="magick.html">Prev</a> | <a href=
|
42
|
+
"index.html">Contents</a> | <a href=
|
43
|
+
"imageattrs.html">Next</a> »
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<h1>class ImageList <span class="superclass"><
|
47
|
+
Array</span><br />
|
48
|
+
<span class="mixin">mixes in Comparable</span></h1>
|
49
|
+
|
50
|
+
<div id="toc">
|
51
|
+
<h2>Table of Contents</h2>
|
52
|
+
|
53
|
+
<h3>class methods</h3>
|
54
|
+
|
55
|
+
<ul>
|
56
|
+
<li><a href="#new">new</a></li>
|
57
|
+
</ul>
|
58
|
+
|
59
|
+
<h3>attributes</h3>
|
60
|
+
|
61
|
+
<ul>
|
62
|
+
<li><a href="#delay_eq">delay=</a></li>
|
63
|
+
|
64
|
+
<li><a href="#iterations_eq">iterations=</a></li>
|
65
|
+
|
66
|
+
<li><a href="#length">length</a></li>
|
67
|
+
|
68
|
+
<li><a href="#scene">scene, scene=</a></li>
|
69
|
+
</ul>
|
70
|
+
|
71
|
+
<h3>instance methods</h3>
|
72
|
+
|
73
|
+
<div class="toccol">
|
74
|
+
<ul>
|
75
|
+
<li><a href="#array_methods">Array methods</a></li>
|
76
|
+
|
77
|
+
<li><a href="#spaceship"><=></a></li>
|
78
|
+
|
79
|
+
<li><a href="#animate">animate</a></li>
|
80
|
+
|
81
|
+
<li><a href="#append">append</a></li>
|
82
|
+
|
83
|
+
<li><a href="#average">average</a></li>
|
84
|
+
|
85
|
+
<li><a href="#clone">clone</a></li>
|
86
|
+
|
87
|
+
<li><a href="#coalesce">coalesce</a></li>
|
88
|
+
|
89
|
+
<li><a href="#copy">copy</a></li>
|
90
|
+
|
91
|
+
<li><a href="#cur_image">cur_image</a></li>
|
92
|
+
</ul>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div class="toccol">
|
96
|
+
<ul>
|
97
|
+
<li><a href="#deconstruct">deconstruct</a></li>
|
98
|
+
|
99
|
+
<li><a href="#dup">dup</a></li>
|
100
|
+
|
101
|
+
<li><a href="#display">display</a></li>
|
102
|
+
|
103
|
+
<li><a href="#flatten_images">flatten_images</a></li>
|
104
|
+
|
105
|
+
<li><a href="#from_blob">from_blob</a></li>
|
106
|
+
|
107
|
+
<li><a href="#inspect">inspect</a></li>
|
108
|
+
|
109
|
+
<li><a href="#map">map</a></li>
|
110
|
+
|
111
|
+
<li><a href="#montage">montage</a></li>
|
112
|
+
</ul>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="toccol">
|
116
|
+
<ul>
|
117
|
+
<li><a href="#morph">morph</a></li>
|
118
|
+
|
119
|
+
<li><a href="#mosaic">mosaic</a></li>
|
120
|
+
|
121
|
+
<li><a href="#new_image">new_image</a></li>
|
122
|
+
|
123
|
+
<li><a href="#ping">ping</a></li>
|
124
|
+
|
125
|
+
<li><a href="#quantize">quantize</a></li>
|
126
|
+
|
127
|
+
<li><a href="#read">read</a></li>
|
128
|
+
|
129
|
+
<li><a href="#to_blob">to_blob</a></li>
|
130
|
+
|
131
|
+
<li><a href="#write">write</a></li>
|
132
|
+
</ul>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<h2 class="methods">class methods</h2>
|
137
|
+
|
138
|
+
<div class="sig">
|
139
|
+
<h3 id="new">new</h3>
|
140
|
+
|
141
|
+
<p>Magick::ImageList.new -> <em>imagelist</em><br />
|
142
|
+
Magick::ImageList.new(<span class="arg">filename[,
|
143
|
+
filename...]]</span>) -> <em>imagelist</em></p>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="desc">
|
147
|
+
<h4>Description</h4>
|
148
|
+
|
149
|
+
<p>Creates a new imagelist. If one or more image filenames are
|
150
|
+
specified, opens and reads the files, adding a new image for
|
151
|
+
each image in the image file(s). Sets the scene number to the
|
152
|
+
index of the last image, or <code>nil</code> if no filenames
|
153
|
+
are specified.</p>
|
154
|
+
|
155
|
+
<h4>Arguments</h4>
|
156
|
+
|
157
|
+
<p>Zero or more image file names.</p>
|
158
|
+
|
159
|
+
<h4>Returns</h4>
|
160
|
+
|
161
|
+
<p>A new imagelist. The imagelist contains an Image object for
|
162
|
+
each image in the specified files. A file can contain more than
|
163
|
+
one image. For example, new will create an image for each frame
|
164
|
+
in an animated GIF or each layer in a multi-layer Photoshop
|
165
|
+
file.</p>
|
166
|
+
|
167
|
+
<h4>Example</h4>
|
168
|
+
<pre>
|
169
|
+
i = Magick::ImageList.new
|
170
|
+
i = Magick::ImageList.new("Button_A.gif", "Cheetah.jpg")
|
171
|
+
</pre>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<h2 class="methods">attributes</h2>
|
175
|
+
|
176
|
+
<div class="sig">
|
177
|
+
<h3 id="delay_eq">delay=</h3>
|
178
|
+
|
179
|
+
<p><span class="arg">imagelist.</span>delay=<em>n</em></p>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div class="desc">
|
183
|
+
<h4>Description</h4>
|
184
|
+
|
185
|
+
<p>Sets the length of time that each image in the imagelist
|
186
|
+
will be displayed when the sequence is animated. The
|
187
|
+
<code>delay=</code> attribute assigns the same delay to all the
|
188
|
+
images in the imagelist. Use <a href=
|
189
|
+
"imageattrs.html#Image.delay">Image#delay=</a> to set different
|
190
|
+
delay values on individual images.</p>
|
191
|
+
|
192
|
+
<h4>Arguments</h4>
|
193
|
+
|
194
|
+
<p>An integer value representing the number of 100ths of a
|
195
|
+
second to display each image.</p>
|
196
|
+
|
197
|
+
<h4>Returns</h4>
|
198
|
+
|
199
|
+
<p>self</p>
|
200
|
+
|
201
|
+
<h4>Example</h4>
|
202
|
+
<pre>
|
203
|
+
imagelist.delay = 20 # delay 1/5 of a second between images.
|
204
|
+
</pre>
|
205
|
+
|
206
|
+
<h4>See also</h4>
|
207
|
+
|
208
|
+
<p><a href="imageattrs.html#Image.delay">Image#delay=</a></p>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div class="sig">
|
212
|
+
<h3 id="iterations_eq">iterations=</h3>
|
213
|
+
|
214
|
+
<p><span class="arg">imagelist.</span>iterations=<em>n</em></p>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="desc">
|
218
|
+
<h4>Description</h4>
|
219
|
+
|
220
|
+
<p>Sets the number of times an animated image should loop.</p>
|
221
|
+
|
222
|
+
<p>The <a href="#animate">animate</a> method and the
|
223
|
+
ImageMagick animate/GraphicsMagick gm utilities do not respect
|
224
|
+
this number. Both will repeat the animation until you stop
|
225
|
+
them. Mozilla (and presumably Netscape) do respect the
|
226
|
+
value..</p>
|
227
|
+
|
228
|
+
<h4>Arguments</h4>
|
229
|
+
|
230
|
+
<p>The number of iterations.</p>
|
231
|
+
|
232
|
+
<h4>Returns</h4>
|
233
|
+
|
234
|
+
<p>self</p>
|
235
|
+
|
236
|
+
<h4>Example</h4>
|
237
|
+
<pre>
|
238
|
+
imagelist.iterations = 10
|
239
|
+
</pre>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div class="sig">
|
243
|
+
<h3 id="length">length</h3>
|
244
|
+
|
245
|
+
<p><span class="arg">imagelist.</span>length ->
|
246
|
+
<em>anInteger</em></p>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div class="desc">
|
250
|
+
<h4>Description</h4>
|
251
|
+
|
252
|
+
<p>Returns the number of images in the imagelist.</p>
|
253
|
+
|
254
|
+
<h4>Example</h4>
|
255
|
+
<pre>
|
256
|
+
i = Magick::ImageList.new("images/Button_A.gif", "images/Button_B.gif")
|
257
|
+
i.length » 2
|
258
|
+
</pre>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div class="sig">
|
262
|
+
<h3 id="scene">scene, scene=</h3>
|
263
|
+
|
264
|
+
<p><span class="arg">imagelist</span>.scene ->
|
265
|
+
<em>anInteger</em><br />
|
266
|
+
<span class="arg">imagelist</span>.scene =
|
267
|
+
<em>anInteger</em></p>
|
268
|
+
</div>
|
269
|
+
|
270
|
+
<div class="desc">
|
271
|
+
<h4>Description</h4>
|
272
|
+
|
273
|
+
<p>Get/set the current <em>scene number</em>. The scene number
|
274
|
+
indicates the image to which <a href="image1.html">Image</a>
|
275
|
+
methods are sent.</p>
|
276
|
+
|
277
|
+
<h4>Example</h4>
|
278
|
+
<pre>
|
279
|
+
imagelist.scene = 10
|
280
|
+
imagelist.scene » 10
|
281
|
+
</pre>
|
282
|
+
</div>
|
283
|
+
|
284
|
+
<h2 class="methods">instance methods</h2>
|
285
|
+
|
286
|
+
<div class="sig">
|
287
|
+
<h3 id="array_methods">Array methods</h3>
|
288
|
+
|
289
|
+
<p>signature</p>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div class="desc">
|
293
|
+
<h4>Description</h4>
|
294
|
+
|
295
|
+
<p><code>ImageList</code> is a subclass of <code>Array</code>,
|
296
|
+
so you can manipulate the images in an imagelist using almost
|
297
|
+
all of the methods defined in <code>Array</code>. Typically
|
298
|
+
these methods also update the scene number. The scene number
|
299
|
+
will never exceed the number of images in the list, and if the
|
300
|
+
imagelist contains no images the scene number will be
|
301
|
+
<code>nil</code>.</p>
|
302
|
+
|
303
|
+
<p>Array methods defined in the ImageList class that would
|
304
|
+
normally return an array return an ImageList.</p>
|
305
|
+
|
306
|
+
<p>Most array methods keep the current image current. If the
|
307
|
+
method moves the current image to a new position, the method
|
308
|
+
updates the scene number to the new index. If the method
|
309
|
+
deletes the current image, the scene number is set to the last
|
310
|
+
image in the list. The following table lists the methods that
|
311
|
+
do not follow these rules.</p>
|
312
|
+
|
313
|
+
<table summary="array method affect on scene number" class=
|
314
|
+
"simple_table">
|
315
|
+
<caption>
|
316
|
+
Array method behavior
|
317
|
+
</caption>
|
318
|
+
|
319
|
+
<thead>
|
320
|
+
<tr>
|
321
|
+
<th>Array method</th>
|
322
|
+
|
323
|
+
<th>scene number will be...</th>
|
324
|
+
</tr>
|
325
|
+
</thead>
|
326
|
+
|
327
|
+
<tbody>
|
328
|
+
<tr>
|
329
|
+
<td><<</td>
|
330
|
+
|
331
|
+
<td>set to index the last image in the list</td>
|
332
|
+
</tr>
|
333
|
+
|
334
|
+
<tr>
|
335
|
+
<td>clear</td>
|
336
|
+
|
337
|
+
<td>set to <code>nil</code></td>
|
338
|
+
</tr>
|
339
|
+
|
340
|
+
<tr>
|
341
|
+
<td>concat</td>
|
342
|
+
|
343
|
+
<td>set to index the last image in the list</td>
|
344
|
+
</tr>
|
345
|
+
|
346
|
+
<tr>
|
347
|
+
<td>push</td>
|
348
|
+
|
349
|
+
<td>set to index the last image in the list</td>
|
350
|
+
</tr>
|
351
|
+
|
352
|
+
<tr>
|
353
|
+
<td>unshift</td>
|
354
|
+
|
355
|
+
<td>set to 0</td>
|
356
|
+
</tr>
|
357
|
+
</tbody>
|
358
|
+
</table>
|
359
|
+
|
360
|
+
<p>Adding anything other than a image to an imagelist has
|
361
|
+
undefined results. Most of the time RMagick will raise an
|
362
|
+
ArgumentError exception.</p>
|
363
|
+
|
364
|
+
<p>The <code>assoc</code>, <code>flatten</code>,
|
365
|
+
<code>flatten!</code>, <code>join</code>, <code>pack</code>,
|
366
|
+
and <code>rassoc</code> methods are not defined in the
|
367
|
+
ImageList class.</p>
|
368
|
+
|
369
|
+
<h4>Example</h4>
|
370
|
+
|
371
|
+
<p>Add noise to a model image. Append the resulting image to
|
372
|
+
the imagelist in "example". (See: <a href=
|
373
|
+
"javascript:popup('demo.rb.html')">demo.rb</a>)</p>
|
374
|
+
<pre>
|
375
|
+
example = Magick::ImageList.new
|
376
|
+
model = Magick::ImageList.new "model.miff"
|
377
|
+
example << model.add_noise Magick::LaplacisanNoise
|
378
|
+
</pre>
|
379
|
+
|
380
|
+
<h4>See also</h4>
|
381
|
+
|
382
|
+
<p><a href="#scene">scene</a>, <a href="#scene">scene=</a></p>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
<div class="sig">
|
386
|
+
<h3 id="spaceship"><=></h3>
|
387
|
+
|
388
|
+
<p><span class="arg">imagelist</span> <=> <span class=
|
389
|
+
"arg">anOtherImageList</span> -> -1, 0, 1</p>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<div class="desc">
|
393
|
+
<h4>Description</h4>
|
394
|
+
|
395
|
+
<p>Compares two imagelists and returns -1, 0, or 1 if the
|
396
|
+
receiver is less than, equal to, or greater than the other
|
397
|
+
imagelist. The comparison between the receiver (a) and the
|
398
|
+
other (b) is performed this way:</p>
|
399
|
+
|
400
|
+
<ol>
|
401
|
+
<li>For all images <code>n</code>, if the result of
|
402
|
+
<code>a[n] <=> b[n]</code> is not 0 then that
|
403
|
+
is the result of a <=> b. Individual images
|
404
|
+
are compared by comparing their <a href=
|
405
|
+
"image3.html#signature">signatures</a>.</li>
|
406
|
+
|
407
|
+
<li>If <code>a.scene <=> b.scene</code> is
|
408
|
+
not 0, returns the result</li>
|
409
|
+
|
410
|
+
<li>Returns
|
411
|
+
<code>a.length <=> b.length</code></li>
|
412
|
+
</ol>
|
413
|
+
|
414
|
+
<p><code>ImageList</code> mixes in the <code>Comparable</code>
|
415
|
+
module.</p>
|
416
|
+
|
417
|
+
<h4>See also</h4>
|
418
|
+
|
419
|
+
<p><a href="image1.html#spaceship">Image#<=></a>,
|
420
|
+
<a href="image3.html#signature">signature</a></p>
|
421
|
+
</div>
|
422
|
+
|
423
|
+
<div class="sig">
|
424
|
+
<h3 id="animate">animate</h3>
|
425
|
+
|
426
|
+
<p><span class="arg">imagelist.</span>animate(<span class=
|
427
|
+
"arg">[delay]</span>) <span class="arg">[ { optional
|
428
|
+
arguments } ]</span> -> <em>self</em></p>
|
429
|
+
</div>
|
430
|
+
|
431
|
+
<div class="desc">
|
432
|
+
<h4>Description</h4>
|
433
|
+
|
434
|
+
<p>Animate the images to an X Window screen. By default
|
435
|
+
displays to the local screen. You can specify a different
|
436
|
+
screen by assigning the name to the <code>server_name</code>
|
437
|
+
attribute in the optional arguments block.</p>
|
438
|
+
|
439
|
+
<h4>Returns</h4>
|
440
|
+
|
441
|
+
<p>self</p>
|
442
|
+
|
443
|
+
<h4>Example</h4>
|
444
|
+
<pre>
|
445
|
+
imagelist.animate
|
446
|
+
imagelist.animate { self.server_name = "other:0.0" }
|
447
|
+
</pre>
|
448
|
+
|
449
|
+
<h4>See also</h4>
|
450
|
+
|
451
|
+
<p><a href="#ImageList.display">display</a></p>
|
452
|
+
|
453
|
+
<h4>Note</h4>
|
454
|
+
<p>The animate method is not supported on native MS Windows.</p>
|
455
|
+
|
456
|
+
<h4>Magick API</h4>
|
457
|
+
|
458
|
+
<p>AnimateImages</p>
|
459
|
+
</div>
|
460
|
+
|
461
|
+
<div class="sig">
|
462
|
+
<h3 id="append">append</h3>
|
463
|
+
|
464
|
+
<p><span class="arg">imagelist.</span>append(<code>true</code>
|
465
|
+
or <code>false</code>) -> <em>anImage</em></p>
|
466
|
+
</div>
|
467
|
+
|
468
|
+
<div class="desc">
|
469
|
+
<h4>Description</h4>
|
470
|
+
|
471
|
+
<p>Append all the images in the imagelist, either vertically or
|
472
|
+
horizontally. If the images are not of the same width, any
|
473
|
+
narrow images will be expanded to fit using the background
|
474
|
+
color.</p>
|
475
|
+
|
476
|
+
<h4>Arguments</h4>
|
477
|
+
|
478
|
+
<p>If <code>true</code>, rectangular images are stacked
|
479
|
+
top-to-bottom, otherwise left-to-right.</p>
|
480
|
+
|
481
|
+
<h4>Returns</h4>
|
482
|
+
|
483
|
+
<p>A image composed of all the images in the imagelist.</p>
|
484
|
+
|
485
|
+
<h4>Example</h4>
|
486
|
+
|
487
|
+
<p>See the <a href="#ImageList.map">map</a> example.</p>
|
488
|
+
|
489
|
+
<h4>Magick API</h4>
|
490
|
+
|
491
|
+
<p>AppendImages</p>
|
492
|
+
</div>
|
493
|
+
|
494
|
+
<div class="sig">
|
495
|
+
<h3 id="average">average</h3>
|
496
|
+
|
497
|
+
<p><span class="arg">imagelist.</span>average ->
|
498
|
+
<em>anImage</em></p>
|
499
|
+
</div>
|
500
|
+
|
501
|
+
<div class="desc">
|
502
|
+
<h4>Description</h4>
|
503
|
+
|
504
|
+
<p>Averages all the images together. Each image in the image
|
505
|
+
must have the same width and height.</p>
|
506
|
+
|
507
|
+
<h4>Returns</h4>
|
508
|
+
|
509
|
+
<p>A single image representing the average of all the images in
|
510
|
+
the imagelist.</p>
|
511
|
+
|
512
|
+
<h4>Example</h4>
|
513
|
+
|
514
|
+
<p class="rollover"><a href=
|
515
|
+
"javascript:popup('average.rb.html')">
|
516
|
+
<!-- This img tag displays the original image when the mouse is over -->
|
517
|
+
<img style="display:none" id="notaveraged" onmouseout=
|
518
|
+
"this.style.display='none'; averaged.style.display=''; averagedspin.style.display='';"
|
519
|
+
title="Click to see the example script" src=
|
520
|
+
"ex/average_before.gif" alt="average example" name=
|
521
|
+
"notaveraged" /><!--
|
522
|
+
This img tag displays the averaged image when the mouse is not over
|
523
|
+
--><img style="display:" id=
|
524
|
+
"averaged" onmouseover=
|
525
|
+
"this.style.display='none'; notaveraged.style.display=''; averagedspin.style.display='none';"
|
526
|
+
src="ex/average_after.gif" alt="average example" name=
|
527
|
+
"averaged" /></a> <img src="ex/images/spin.gif" alt="" class=
|
528
|
+
"spin" style="left:131px; display:" id="averagedspin" title=
|
529
|
+
"Mouse over the example to see the 3 original images" name=
|
530
|
+
"averagedspin" /></p>
|
531
|
+
|
532
|
+
<h4>Magick API</h4>
|
533
|
+
|
534
|
+
<p>AverageImages</p>
|
535
|
+
</div>
|
536
|
+
|
537
|
+
<div class="sig">
|
538
|
+
<h3 id="clone">clone</h3>
|
539
|
+
|
540
|
+
<p><span class="arg">imagelist</span>.clone ->
|
541
|
+
<em>anImageList</em></p>
|
542
|
+
</div>
|
543
|
+
|
544
|
+
<div class="desc">
|
545
|
+
<h4>Description</h4>
|
546
|
+
|
547
|
+
<p>Same as <a href="#dup">dup</a>, but the frozen state of the
|
548
|
+
original is propogated to the copy.</p>
|
549
|
+
|
550
|
+
<h4>Returns</h4>
|
551
|
+
|
552
|
+
<p>A new imagelist</p>
|
553
|
+
|
554
|
+
<h4>See also</h4>
|
555
|
+
|
556
|
+
<p><a href="#copy">copy</a></p>
|
557
|
+
</div>
|
558
|
+
|
559
|
+
<div class="sig">
|
560
|
+
<h3 id="coalesce">coalesce</h3>
|
561
|
+
|
562
|
+
<p><span class="arg">imagelist.</span>coalesce ->
|
563
|
+
<em>anImageList</em></p>
|
564
|
+
</div>
|
565
|
+
|
566
|
+
<div class="desc">
|
567
|
+
<h4>Description</h4>
|
568
|
+
|
569
|
+
<p>Merges all the images in the imagelist into a new imagelist.
|
570
|
+
Each image in the new imagelist is formed by flattening all the
|
571
|
+
previous images.</p>
|
572
|
+
|
573
|
+
<p>The length of time between images in the new image is
|
574
|
+
specified by the <a href=
|
575
|
+
"imageattrs.html#Image.delay">delay</a> attribute of the input
|
576
|
+
image. The position of the image on the merged images is
|
577
|
+
specified by the <a href="imageattrs.html#Image.page">page</a>
|
578
|
+
attribute of the input image.</p>
|
579
|
+
|
580
|
+
<h4>Returns</h4>
|
581
|
+
|
582
|
+
<p>A new imagelist</p>
|
583
|
+
|
584
|
+
<h4>Example</h4>
|
585
|
+
|
586
|
+
<p>This example is an animated GIF created by coalescing 25
|
587
|
+
small images in a grid. Mouse over the image to start the
|
588
|
+
animation.</p>
|
589
|
+
|
590
|
+
<p class="rollover"><a href=
|
591
|
+
"javascript:popup('coalesce.rb.html')"><img onmouseover=
|
592
|
+
"this.src='ex/coalesce_anim.gif'" onmouseout=
|
593
|
+
"this.src='ex/coalesce.gif'" src="ex/coalesce.gif" alt=
|
594
|
+
"coalesce example" title=
|
595
|
+
"Click the image to see the example script" /></a><img src=
|
596
|
+
"ex/images/spin.gif" alt="" class="spin" style="left:159px"
|
597
|
+
title="Mouse over the example to see the animation" /></p>
|
598
|
+
|
599
|
+
<h4>See also</h4><a href="#flatten_images">flatten_images</a>
|
600
|
+
|
601
|
+
<h4>Magick API</h4>
|
602
|
+
|
603
|
+
<p>CoalesceImages</p>
|
604
|
+
</div>
|
605
|
+
|
606
|
+
<div class="sig">
|
607
|
+
<h3 id="copy">copy</h3>
|
608
|
+
|
609
|
+
<p><span class="arg">imagelist.</span>copy ->
|
610
|
+
<em>anImageList</em></p>
|
611
|
+
</div>
|
612
|
+
|
613
|
+
<div class="desc">
|
614
|
+
<h4>Description</h4>
|
615
|
+
|
616
|
+
<p>Creates a deep copy of the imagelist. The new imagelist
|
617
|
+
contains a copy of all the images in the original
|
618
|
+
imagelist.</p>
|
619
|
+
|
620
|
+
<h4>Returns</h4>
|
621
|
+
|
622
|
+
<p>An imagelist</p>
|
623
|
+
|
624
|
+
<h4>Example</h4>
|
625
|
+
<pre>
|
626
|
+
imagelist2 = imagelist1.copy
|
627
|
+
</pre>
|
628
|
+
|
629
|
+
<h4>See also</h4><a href="image1.html#copy">Image#copy</a>,
|
630
|
+
<a href="#clone">clone</a>, <a href="#dup">dup</a>
|
631
|
+
</div>
|
632
|
+
|
633
|
+
<div class="sig">
|
634
|
+
<h3 id="cur_image">cur_image</h3>
|
635
|
+
|
636
|
+
<p><span class="arg">imagelist.</span>cur_image ->
|
637
|
+
<em>anImage</em></p>
|
638
|
+
</div>
|
639
|
+
|
640
|
+
<div class="desc">
|
641
|
+
<h4>Description</h4>
|
642
|
+
|
643
|
+
<p>Retrieves the image indexed by <a href="#scene">scene</a>.
|
644
|
+
Raises <code>IndexError</code> if there are no images in the
|
645
|
+
list.</p>
|
646
|
+
|
647
|
+
<p>Both the ImageList class and the Image class support the
|
648
|
+
<code>cur_image</code> method. Of course, in the Image class,
|
649
|
+
<code>cur_image</code> simply returns <code>self</code>. When a
|
650
|
+
method accepts either an image or a imagelist as an argument,
|
651
|
+
it sends the <code>cur_image</code> method to the argument to
|
652
|
+
get the current image.</p>
|
653
|
+
|
654
|
+
<h4>Returns</h4>
|
655
|
+
|
656
|
+
<p>An image</p>
|
657
|
+
</div>
|
658
|
+
|
659
|
+
<div class="sig">
|
660
|
+
<h3 id="deconstruct">deconstruct</h3>
|
661
|
+
|
662
|
+
<p><span class="arg">imagelist.</span>deconstruct ->
|
663
|
+
<em>anImageList</em></p>
|
664
|
+
</div>
|
665
|
+
|
666
|
+
<div class="desc">
|
667
|
+
<h4>Description</h4>
|
668
|
+
|
669
|
+
<p>This method constructs a new imagelist containing images
|
670
|
+
that include only the changed pixels between each image and its
|
671
|
+
successor. The resulting imagelist usually produces a much
|
672
|
+
smaller file.</p>
|
673
|
+
|
674
|
+
<p>The <code>desconstruct</code> method starts by copying the
|
675
|
+
first image in the list to the output imagelist. Then, for each
|
676
|
+
pair of images, <code>deconstruct</code> computes the smallest
|
677
|
+
rectangle that encompasses all the changes between the first
|
678
|
+
and second image and stores just the changed rectangle of the
|
679
|
+
second image, along with the offset of the rectangle relative
|
680
|
+
to the boundary of the first image.</p>
|
681
|
+
|
682
|
+
<h4>Returns</h4>
|
683
|
+
|
684
|
+
<p>A new imagelist</p>
|
685
|
+
|
686
|
+
<h4>Magick API</h4>
|
687
|
+
|
688
|
+
<p>DeconstructImages</p>
|
689
|
+
</div>
|
690
|
+
|
691
|
+
<div class="sig">
|
692
|
+
<h3 id="dup">dup</h3>
|
693
|
+
|
694
|
+
<p><span class="arg">imagelist</span>.dup ->
|
695
|
+
<em>anImageList</em></p>
|
696
|
+
</div>
|
697
|
+
|
698
|
+
<div class="desc">
|
699
|
+
<h4>Description</h4>
|
700
|
+
|
701
|
+
<p>Makes a <em>shallow</em> copy of the receiver. The image
|
702
|
+
elements in the new imagelist are references to the image
|
703
|
+
elements in the original imagelist, not copies.</p>
|
704
|
+
|
705
|
+
<h4>See also</h4>
|
706
|
+
|
707
|
+
<p><a href="#copy">copy</a>, <a href="#clone">clone</a></p>
|
708
|
+
</div>
|
709
|
+
|
710
|
+
<div class="sig">
|
711
|
+
<h3 id="display">display</h3>
|
712
|
+
|
713
|
+
<p><span class="arg">imagelist.</span>display <span class=
|
714
|
+
"arg">[ { optional arguments } ]</span> ->
|
715
|
+
<em>self</em></p>
|
716
|
+
</div>
|
717
|
+
|
718
|
+
<div class="desc">
|
719
|
+
<h4>Description</h4>
|
720
|
+
|
721
|
+
<p>Displays the images in the imagelist to any X Window screen.
|
722
|
+
By default displays to the local screen. You can specify a
|
723
|
+
different screen by assigning the name to the
|
724
|
+
<code>server_name</code> attribute in the optional arguments
|
725
|
+
block.</p>
|
726
|
+
|
727
|
+
<h4>Returns</h4>
|
728
|
+
|
729
|
+
<p>self</p>
|
730
|
+
|
731
|
+
<h4>See also</h4>
|
732
|
+
|
733
|
+
<p><a href="#animate">animate</a>, <a href=
|
734
|
+
"image1.html#display">Image#display</a></p>
|
735
|
+
|
736
|
+
<h4>Magick API</h4>
|
737
|
+
|
738
|
+
<p>DisplayImages</p>
|
739
|
+
</div>
|
740
|
+
|
741
|
+
<div class="sig">
|
742
|
+
<h3 id="flatten_images">flatten_images</h3>
|
743
|
+
|
744
|
+
<p><span class="arg">imagelist.</span>flatten_images ->
|
745
|
+
<em>anImage</em></p>
|
746
|
+
</div>
|
747
|
+
|
748
|
+
<div class="desc">
|
749
|
+
<h4>Description</h4>
|
750
|
+
|
751
|
+
<p>Combines all the images in the imagelist into a single image
|
752
|
+
by overlaying each successive image onto the preceding images.
|
753
|
+
If a image has transparent areas, the underlying image will
|
754
|
+
show through. Use the <a href="imageattrs.html#page">page</a>
|
755
|
+
attribute to specify the position of each image with respect to
|
756
|
+
the preceding images.</p>
|
757
|
+
|
758
|
+
<p class="imquote">This is useful for combining Photoshop
|
759
|
+
layers into a single image.</p>
|
760
|
+
|
761
|
+
<h4>Returns</h4>
|
762
|
+
|
763
|
+
<p>An image</p>
|
764
|
+
|
765
|
+
<h4>Example</h4>
|
766
|
+
|
767
|
+
<p><a href=
|
768
|
+
"javascript:popup('flatten_images.rb.html')"><img alt=
|
769
|
+
"flatten_images example" src="ex/flatten_images.gif" title=
|
770
|
+
"Click to see the example script" /></a></p>
|
771
|
+
|
772
|
+
<h4>See also</h4>
|
773
|
+
|
774
|
+
<p><a href="#coalesce">coalesce</a></p>
|
775
|
+
|
776
|
+
<h4>Magick API</h4>
|
777
|
+
|
778
|
+
<p>FlattenImageList</p>
|
779
|
+
</div>
|
780
|
+
|
781
|
+
<div class="sig">
|
782
|
+
<h3 id="from_blob">from_blob</h3>
|
783
|
+
|
784
|
+
<p><span class=
|
785
|
+
"arg">imagelist.</span>from_blob(blob<span class="arg">[,
|
786
|
+
blob...]</span>) <span class="arg">[ { optional arguments
|
787
|
+
} ]</span> -> <em>self</em></p>
|
788
|
+
</div>
|
789
|
+
|
790
|
+
<div class="desc">
|
791
|
+
<h4>Description</h4>
|
792
|
+
|
793
|
+
<p>Creates images from the blob (<em>B</em>inary <em>L</em>arge
|
794
|
+
<em>O</em>bjects) arguments and appends the images to the
|
795
|
+
imagelist.</p>
|
796
|
+
|
797
|
+
<h4>Arguments</h4>
|
798
|
+
|
799
|
+
<p>One or more of the strings produced by <a href=
|
800
|
+
"#to_blob">to_blob</a>. Control the format of the created
|
801
|
+
image(s) by setting additional <a href=
|
802
|
+
"info.html">Image::Info</a> attributes in the optional block
|
803
|
+
argument. Useful attributes include <a href=
|
804
|
+
"info.html#Info.format">format</a>, <a href=
|
805
|
+
"info.html#Info.size">size</a>, and <a href=
|
806
|
+
"info.html#Info.depth">depth</a>.</p>
|
807
|
+
|
808
|
+
<h4>Returns</h4>
|
809
|
+
|
810
|
+
<p>An image created from the blob argument(s). The
|
811
|
+
<code>scene</code> attribute is set to the last image in the
|
812
|
+
imagelist.</p>
|
813
|
+
|
814
|
+
<h4>Example</h4>
|
815
|
+
<pre>
|
816
|
+
imagelist = Magick::ImageList.new
|
817
|
+
imagelist.from_blob(blob) {
|
818
|
+
self.format = "GIF"
|
819
|
+
self.size = "120x120"
|
820
|
+
self.depth = Magick::QuantumDepth
|
821
|
+
}
|
822
|
+
</pre>
|
823
|
+
|
824
|
+
<h4>See also</h4><a href="#to_blob">to_blob</a>, <a href=
|
825
|
+
"image3.html#to_blob">Image#to_blob</a>, <a href=
|
826
|
+
"image1.html#from_blob">Image.from_blob</a>
|
827
|
+
|
828
|
+
<h4>Magick API</h4>
|
829
|
+
|
830
|
+
<p>BlobToImageList</p>
|
831
|
+
</div>
|
832
|
+
|
833
|
+
<div class="sig">
|
834
|
+
<h3 id="inspect">inspect</h3>
|
835
|
+
|
836
|
+
<p><span class="arg">imagelist.</span>inspect ->
|
837
|
+
<em>aString</em></p>
|
838
|
+
</div>
|
839
|
+
|
840
|
+
<div class="desc">
|
841
|
+
<h4>Description</h4>
|
842
|
+
|
843
|
+
<p>Produces a string that describes the images in the
|
844
|
+
imagelist.</p>
|
845
|
+
|
846
|
+
<h4>Arguments</h4>
|
847
|
+
|
848
|
+
<h4>Returns</h4>
|
849
|
+
|
850
|
+
<p>The returned string is a concatenation of the strings
|
851
|
+
returned by <a href="image2.html#inspect">Image#inspect</a> for
|
852
|
+
all the images in the imagelist.</p>
|
853
|
+
|
854
|
+
<h4>Example</h4>
|
855
|
+
<pre>
|
856
|
+
i = Magick::ImageList.new("images/Button_A.gif", "images/Button_B.gif")
|
857
|
+
» [images/Button_A.gif GIF 127x120+0+0 PseudoClass 256c 8-bit 18136b
|
858
|
+
images/Button_B.gif GIF 127x120+0+0 PseudoClass 256c 8-bit 5157b]
|
859
|
+
scene=1
|
860
|
+
</pre>
|
861
|
+
|
862
|
+
<h4>See also</h4>
|
863
|
+
|
864
|
+
<p><a href="image2.html#inspect">Image#inspect</a></p>
|
865
|
+
|
866
|
+
<h4>Magick API</h4>
|
867
|
+
|
868
|
+
<p>The description is essentially the same as that provided by
|
869
|
+
<a href=
|
870
|
+
"http://www.imagemagick.org/www/api/image.html#describeimage">DescribeImageList</a></p>
|
871
|
+
</div>
|
872
|
+
|
873
|
+
<div class="sig">
|
874
|
+
<h3 id="map">map</h3>
|
875
|
+
|
876
|
+
<p><span class="arg">imagelist.map</span>(<span class=
|
877
|
+
"arg">reference</span>, <span class="arg">dither</span>) ->
|
878
|
+
<em>anImageList</em></p>
|
879
|
+
</div>
|
880
|
+
|
881
|
+
<div class="desc">
|
882
|
+
<h4>Description</h4>
|
883
|
+
|
884
|
+
<p>Reduces the colors in the imagelist images to the set of
|
885
|
+
colors in the <span class="arg">reference</span> image.</p>
|
886
|
+
|
887
|
+
<h4>Arguments</h4>
|
888
|
+
|
889
|
+
<dl>
|
890
|
+
<dt>reference</dt>
|
891
|
+
|
892
|
+
<dd>An image or a imagelist. If an imagelist,
|
893
|
+
<code>map</code> uses the current image as the reference
|
894
|
+
image.</dd>
|
895
|
+
|
896
|
+
<dt>dither</dt>
|
897
|
+
|
898
|
+
<dd>if <code>true</code>, dither the mapped images.</dd>
|
899
|
+
</dl>
|
900
|
+
|
901
|
+
<h4>Returns</h4>
|
902
|
+
|
903
|
+
<p>A new imagelist the same length as the receiver.</p>
|
904
|
+
|
905
|
+
<h4>Example</h4>
|
906
|
+
|
907
|
+
<p>This example demonstrates how to map images into the 216
|
908
|
+
"Web safe" colors. Mouse over the image to see the images
|
909
|
+
before mapping.</p>
|
910
|
+
|
911
|
+
<p class="rollover"><a href=
|
912
|
+
"javascript:popup('map.rb.html')"><img src="ex/map_after.jpg"
|
913
|
+
alt="map example" title="Click to see the example script"
|
914
|
+
onmouseover="this.src='ex/map_before.jpg'" onmouseout=
|
915
|
+
"this.src='ex/map_after.jpg'" /></a><img src=
|
916
|
+
"ex/images/spin.gif" alt="" class="spin" style="left: 525px;"
|
917
|
+
title="Mouse over the example to see the original image" /></p>
|
918
|
+
|
919
|
+
<h4>See also</h4>
|
920
|
+
|
921
|
+
<p><a href="image2.html#map">Image#map</a>, <a href=
|
922
|
+
"#quantize">quantize</a></p>
|
923
|
+
|
924
|
+
<h4>Magick API</h4>
|
925
|
+
|
926
|
+
<p>MapImages</p>
|
927
|
+
</div>
|
928
|
+
|
929
|
+
<div class="sig">
|
930
|
+
<h3 id="montage">montage</h3>
|
931
|
+
|
932
|
+
<p><span class="arg">imagelist.</span>montage <span class=
|
933
|
+
"arg">[ { optional arguments } ]</span> ->
|
934
|
+
<em>anImageList</em></p>
|
935
|
+
</div>
|
936
|
+
|
937
|
+
<div class="desc">
|
938
|
+
<h4>Description</h4>
|
939
|
+
|
940
|
+
<p>Creates a composite image by reducing the size of the input
|
941
|
+
images and arranging them in a grid on the background color or
|
942
|
+
texture of your choice. There are many configuration options.
|
943
|
+
For example, you can specify the number of columns and rows,
|
944
|
+
the distance between images, and include a label with each
|
945
|
+
small image (called a <em>tile</em>).</p>
|
946
|
+
|
947
|
+
<p>All of <code>montage</code>'s configuration options are
|
948
|
+
specified by assigning values to attributes in a block
|
949
|
+
associated with the method call.</p>
|
950
|
+
|
951
|
+
<p>As you can see in the examples below, when you assign a
|
952
|
+
value to a montage attribute you must specify <code>self</code>
|
953
|
+
as the receiver so that Ruby can distinguish the method call
|
954
|
+
from an assignment to a local variable.</p>
|
955
|
+
|
956
|
+
<p>You may assign a <a href="struct.html#Pixel">Pixel</a>
|
957
|
+
object to any attribute that accepts a color name.</p>
|
958
|
+
|
959
|
+
<h4>Montage attributes</h4>
|
960
|
+
|
961
|
+
<dl>
|
962
|
+
<dt>background_color=</dt>
|
963
|
+
|
964
|
+
<dd>The composite image background color.</dd>
|
965
|
+
|
966
|
+
<dt>border_color=</dt>
|
967
|
+
|
968
|
+
<dd>The tile border color.</dd>
|
969
|
+
|
970
|
+
<dt>border_width=</dt>
|
971
|
+
|
972
|
+
<dd>The tile border width in pixels.</dd>
|
973
|
+
|
974
|
+
<dt>compose=</dt>
|
975
|
+
|
976
|
+
<dd>The <a href="constants.html#CompositeOperator">composite
|
977
|
+
operator</a> to use when compositing the tile images onto the
|
978
|
+
background. The default composition operator is
|
979
|
+
<code>OverCompositeOp</code>.</dd>
|
980
|
+
|
981
|
+
<dd><em>Hint:</em> You can use a different composite operator
|
982
|
+
for each tile by setting each image's <a href=
|
983
|
+
"imageattrs.html#Image.compose">compose=</a> attribute to the
|
984
|
+
desired operator. In the optional arguments block, set
|
985
|
+
<code>compose</code> to UndefinedCompositeOp.</dd>
|
986
|
+
|
987
|
+
<dt>fill=</dt>
|
988
|
+
|
989
|
+
<dd>If the tiles have labels, the label fill color. The
|
990
|
+
default fill color is black.</dd>
|
991
|
+
|
992
|
+
<dt>font=</dt>
|
993
|
+
|
994
|
+
<dd>If the tiles have labels, the label font. The default
|
995
|
+
font is Helvetica.</dd>
|
996
|
+
|
997
|
+
<dt>frame=</dt>
|
998
|
+
|
999
|
+
<dd>
|
1000
|
+
The size of an ornamental frame surrounding each tile. The
|
1001
|
+
frame specification may be either a string or a <a href=
|
1002
|
+
"struct.html#Geometry">Geometry</a> object. If the argument
|
1003
|
+
is a string, it must have the form
|
1004
|
+
<code><width>x<height>+<outer bevel
|
1005
|
+
width>+<inner bevel width></code>. If the argument
|
1006
|
+
is a Geometry object, specify the width and height of the
|
1007
|
+
frame with the <code>width</code> and <code>height</code>
|
1008
|
+
attributes, and specify the outer bevel width and the inner
|
1009
|
+
bevel width with the <code>x</code> and <code>y</code>
|
1010
|
+
attributes. The values are in pixels. For example, to
|
1011
|
+
surround each tile with a frame 20 pixels wide by 20 pixels
|
1012
|
+
high and a 4-pixel inner and outer bevel, use:
|
1013
|
+
<pre>
|
1014
|
+
self.frame = "20x20+4+4"
|
1015
|
+
</pre>or
|
1016
|
+
<pre>
|
1017
|
+
self.frame = Magick::Geometry.new(20,20,4,4)
|
1018
|
+
</pre>
|
1019
|
+
</dd>
|
1020
|
+
|
1021
|
+
<dd>If the tile has a label, the label is included in the
|
1022
|
+
frame. The default is to have no frame.</dd>
|
1023
|
+
|
1024
|
+
<dd>See <a href="image1.html#frame">Image#frame</a>.</dd>
|
1025
|
+
|
1026
|
+
<dt>geometry=</dt>
|
1027
|
+
|
1028
|
+
<dd>
|
1029
|
+
The size of the tiles and the distance between tiles. The
|
1030
|
+
value can be either a <a href=
|
1031
|
+
"imusage.html#geometry">geometry string</a> or a <a href=
|
1032
|
+
"struct.html#Geometry">Geometry</a> object. The geometry
|
1033
|
+
string has the form:
|
1034
|
+
<code><tile-width>x<tile-height>+<distance-between-columns>+<distance-between-rows></code>.
|
1035
|
+
If you use a Geometry object, specify the tile width and
|
1036
|
+
height with the <code>width</code> and <code>height</code>
|
1037
|
+
attributes, and the distance between rows and distance
|
1038
|
+
between columns by the <code>x</code> and <code>y</code>
|
1039
|
+
attributes. To create tiles that are 130 pixels wide and
|
1040
|
+
194 pixels tall, with 10 pixels between each column of
|
1041
|
+
tiles and 5 between each row, use:
|
1042
|
+
<pre>
|
1043
|
+
self.geometry = "130x194+10+5"
|
1044
|
+
</pre>or
|
1045
|
+
<pre>
|
1046
|
+
self.geometry = Magick::Geometry.new(130, 194, 10, 5)
|
1047
|
+
</pre>Both the geometry string and the <code>Geometry</code> object
|
1048
|
+
support flags that specify additional constraints. The default
|
1049
|
+
geometry is "120x120+4+3>".
|
1050
|
+
</dd>
|
1051
|
+
|
1052
|
+
<dt>gravity=</dt>
|
1053
|
+
|
1054
|
+
<dd>The <a href="constants.html#GravityType">direction</a>
|
1055
|
+
used when adding the tile labels. (See <a href=
|
1056
|
+
"draw.html#Draw.annotate">annotate</a>.)</dd>
|
1057
|
+
|
1058
|
+
<dt>matte_color=</dt>
|
1059
|
+
|
1060
|
+
<dd>The matte color. The default is #bdbdbd.</dd>
|
1061
|
+
|
1062
|
+
<dt>pointsize=</dt>
|
1063
|
+
|
1064
|
+
<dd>If the tiles have labels, the size of the label font in
|
1065
|
+
points. The default is 12 points.</dd>
|
1066
|
+
|
1067
|
+
<dt>shadow=</dt>
|
1068
|
+
|
1069
|
+
<dd>If set to <code>true</code>, adds a drop shadow to each
|
1070
|
+
tile. The default is <code>false</code>.</dd>
|
1071
|
+
|
1072
|
+
<dt>stroke=</dt>
|
1073
|
+
|
1074
|
+
<dd>If the tiles have labels, sets the stroke (outline) color
|
1075
|
+
of the label text. The default is "transparent".</dd>
|
1076
|
+
|
1077
|
+
<dt>texture=</dt>
|
1078
|
+
|
1079
|
+
<dd>
|
1080
|
+
A image to be tiled on the background of the composite
|
1081
|
+
image. If present, this attribute overrides the background
|
1082
|
+
color. For example, to use ×Magick's built-in
|
1083
|
+
"granite" texture as the background, use:
|
1084
|
+
<pre>
|
1085
|
+
self.texture = Magick::Image.read("granite:").first
|
1086
|
+
</pre>
|
1087
|
+
|
1088
|
+
<p>The default is no texture.</p>
|
1089
|
+
</dd>
|
1090
|
+
|
1091
|
+
<dt>tile=</dt>
|
1092
|
+
|
1093
|
+
<dd>
|
1094
|
+
The number of columns and rows to use when arranging the
|
1095
|
+
tiles on the composite image. The value can be either a
|
1096
|
+
string or a <a href="struct.html#Geometry">Geometry</a>
|
1097
|
+
object. If the value is a string, it should have the form
|
1098
|
+
<code>"<columns>x<rows>"</code>. If the value
|
1099
|
+
is a Geometry object, specify the number of columns as the
|
1100
|
+
<code>width</code> attribute and the number of rows as the
|
1101
|
+
<code>height</code> attribute. <code>montage</code> always
|
1102
|
+
generates all the rows, leaving empty cells if necessary.
|
1103
|
+
To arrange the tiles 4 across and 10 down, use:
|
1104
|
+
<pre>
|
1105
|
+
self.tile = "4x10"
|
1106
|
+
</pre>or
|
1107
|
+
<pre>
|
1108
|
+
self.tile = Magick::Geometry.new(4,10)
|
1109
|
+
</pre>
|
1110
|
+
|
1111
|
+
<p>The default is "6x4". If there are too many tiles to fit
|
1112
|
+
on one composite image, <code>montage</code> creates
|
1113
|
+
multiple composite images.</p>
|
1114
|
+
</dd>
|
1115
|
+
</dl>
|
1116
|
+
|
1117
|
+
<h4>Tile labels</h4>
|
1118
|
+
|
1119
|
+
<p>To add labels to the tiles, assign a "Label" property to
|
1120
|
+
each image. The <code>montage</code> method will use the value
|
1121
|
+
of the property as the label. For example,</p>
|
1122
|
+
<pre>
|
1123
|
+
img[2]['Label'] = "Mom's Birthday"
|
1124
|
+
</pre>
|
1125
|
+
|
1126
|
+
<p>See <a href="image1.html#aset">[]=</a>.</p>
|
1127
|
+
|
1128
|
+
<h4>Returns</h4>
|
1129
|
+
|
1130
|
+
<p>An imagelist that contains as many images as are required to
|
1131
|
+
display all the tiles.</p>
|
1132
|
+
|
1133
|
+
<h4>Example</h4><a href=
|
1134
|
+
"javascript:popup('demo.rb.html')">demo.rb</a>
|
1135
|
+
|
1136
|
+
<h4>Magick API</h4>
|
1137
|
+
|
1138
|
+
<p>MontageImages</p>
|
1139
|
+
</div>
|
1140
|
+
|
1141
|
+
<div class="sig">
|
1142
|
+
<h3 id="morph">morph</h3>
|
1143
|
+
|
1144
|
+
<p><span class="arg">imagelist.</span>morph(<span class=
|
1145
|
+
"arg">n</span>) -> <em>anImageList</em></p>
|
1146
|
+
</div>
|
1147
|
+
|
1148
|
+
<div class="desc">
|
1149
|
+
<h4>Description</h4>
|
1150
|
+
|
1151
|
+
<p>Transforms a image into another image by inserting
|
1152
|
+
<code>n</code> in-between images. Requires at least two images.
|
1153
|
+
If more images are present, the 2nd image is transformed into
|
1154
|
+
the 3rd, the 3rd to the 4th, etc.</p>
|
1155
|
+
|
1156
|
+
<h4>Arguments</h4>
|
1157
|
+
|
1158
|
+
<p>The number of in-between images to insert between each pair
|
1159
|
+
of images.</p>
|
1160
|
+
|
1161
|
+
<h4>Returns</h4>
|
1162
|
+
|
1163
|
+
<p>An imagelist containing copies of the original images plus
|
1164
|
+
the in-between images.</p>
|
1165
|
+
|
1166
|
+
<h4>Example</h4>
|
1167
|
+
|
1168
|
+
<p>This animated GIF was created by reading the "0", "1", "2"
|
1169
|
+
and "3" images, then using <code>morph</code> to create 8
|
1170
|
+
images between each original image. Mouse over the image to
|
1171
|
+
start the animation.</p>
|
1172
|
+
|
1173
|
+
<p class="rollover"><a href=
|
1174
|
+
"javascript:popup('morph.rb.html')"><img onmouseover=
|
1175
|
+
"this.src='ex/morph.gif'" onmouseout=
|
1176
|
+
"this.src='ex/images/Button_0.gif'" src=
|
1177
|
+
"ex/images/Button_0.gif" alt="morph example" title=
|
1178
|
+
"Click the image to see the example script" /></a><img src=
|
1179
|
+
"ex/images/spin.gif" alt="" class="spin" style="left:131px"
|
1180
|
+
title="Mouse over the example to see the animation" /></p>
|
1181
|
+
|
1182
|
+
<h4>Magick API</h4>
|
1183
|
+
|
1184
|
+
<p>MorphImages</p>
|
1185
|
+
</div>
|
1186
|
+
|
1187
|
+
<div class="sig">
|
1188
|
+
<h3 id="mosaic">mosaic</h3>
|
1189
|
+
|
1190
|
+
<p><span class="arg">imagelist.</span>mosaic ->
|
1191
|
+
<em>anImage</em></p>
|
1192
|
+
</div>
|
1193
|
+
|
1194
|
+
<div class="desc">
|
1195
|
+
<h4>Description</h4>
|
1196
|
+
|
1197
|
+
<p>Composites all the images into a single new image. The
|
1198
|
+
location of each image is determined by the value of its
|
1199
|
+
<a href="imageattrs.html#Image.page">page</a> attribute.</p>
|
1200
|
+
|
1201
|
+
<h4>Returns</h4>
|
1202
|
+
|
1203
|
+
<p>An image</p>
|
1204
|
+
|
1205
|
+
<h4>Example</h4>
|
1206
|
+
|
1207
|
+
<p><a href="javascript:popup('mosaic.rb.html')"><img src=
|
1208
|
+
"ex/mosaic.gif" alt="mosaic example" title=
|
1209
|
+
"Click to see the example script" /></a></p>
|
1210
|
+
|
1211
|
+
<h4>See also</h4><a href="#coalesce">coalesce</a>, <a href=
|
1212
|
+
"#flatten_images">flatten_images</a>, <a href=
|
1213
|
+
"#montage">montage</a>
|
1214
|
+
|
1215
|
+
<h4>Magick API</h4>
|
1216
|
+
|
1217
|
+
<p>MosaicImages</p>
|
1218
|
+
</div>
|
1219
|
+
|
1220
|
+
<div class="sig">
|
1221
|
+
<h3 id="new_image">new_image</h3>
|
1222
|
+
|
1223
|
+
<p><span class="arg">imagelist.</span>new_image(<span class=
|
1224
|
+
"arg">columns</span>, <span class="arg">rows</span><span class=
|
1225
|
+
"arg">[, fill]</span>) <span class="arg">[ { optional
|
1226
|
+
arguments } ]</span> -> <em>self</em></p>
|
1227
|
+
</div>
|
1228
|
+
|
1229
|
+
<div class="desc">
|
1230
|
+
<h4>Description</h4>
|
1231
|
+
|
1232
|
+
<p>Adds a new image to the imagelist. The image can have an
|
1233
|
+
optional <a href="struct.html#fill">fill</a> applied to it.</p>
|
1234
|
+
|
1235
|
+
<h4>Arguments</h4>
|
1236
|
+
|
1237
|
+
<p>Creates a new image with the specified number of rows and
|
1238
|
+
columns. If the optional <code>fill</code> argument is used,
|
1239
|
+
calls the <code>fill</code> method to fill the image.
|
1240
|
+
Otherwise, the image is filled with the background color.</p>
|
1241
|
+
|
1242
|
+
<p>You can set any <a href="info.html">Image::Info</a>
|
1243
|
+
attributes in an associated block. These attributes supply
|
1244
|
+
options to be used when creating the image. For example, you
|
1245
|
+
can specify the <a href=
|
1246
|
+
"imageattrs.html#background_color">background color</a> to fill
|
1247
|
+
the image with (see the example), the <a href=
|
1248
|
+
"imageattrs.html#depth">depth</a>, <a href=
|
1249
|
+
"imageattrs.html#border_color">border color</a>, etc.</p>
|
1250
|
+
|
1251
|
+
<h4>Returns</h4>
|
1252
|
+
|
1253
|
+
<p>self</p>
|
1254
|
+
|
1255
|
+
<h4>Example</h4>
|
1256
|
+
|
1257
|
+
<p>Create a square red image.</p>
|
1258
|
+
<pre>
|
1259
|
+
imagelist = Magick::ImageList.new
|
1260
|
+
imagelist.new_image(100, 100) { self.background_color = "red" }
|
1261
|
+
</pre>
|
1262
|
+
</div>
|
1263
|
+
|
1264
|
+
<div class="sig">
|
1265
|
+
<h3 id="ping">ping</h3>
|
1266
|
+
|
1267
|
+
<p><span class="arg">imagelist.</span>ping(<span class=
|
1268
|
+
"arg">filename</span>[, <span class="arg">filename</span>...])
|
1269
|
+
-> <em>self</em><br />
|
1270
|
+
<span class="arg">imagelist.</span>ping(<span class=
|
1271
|
+
"arg">file</span>[, <span class="arg">file</span>...]) ->
|
1272
|
+
<em>self</em></p>
|
1273
|
+
</div>
|
1274
|
+
|
1275
|
+
<div class="desc">
|
1276
|
+
<h4>Description</h4>
|
1277
|
+
|
1278
|
+
<p>Reads the image files and creates one or more images that
|
1279
|
+
contain all the image attributes but without the pixel data. If
|
1280
|
+
all you need is the image attributes, the <code>ping</code>
|
1281
|
+
method is much faster and consumes less memory than <a href=
|
1282
|
+
"#read"><code>read</code></a>.</p>
|
1283
|
+
|
1284
|
+
<h4>Arguments</h4>
|
1285
|
+
|
1286
|
+
<p>One or more image file names or open file objects.</p>
|
1287
|
+
|
1288
|
+
<h4>Returns</h4>
|
1289
|
+
|
1290
|
+
<p>self</p>
|
1291
|
+
|
1292
|
+
<h4>Example</h4>
|
1293
|
+
<pre>
|
1294
|
+
imagelist = Magick::ImageList.new
|
1295
|
+
imagelist.ping "Button_A.gif"
|
1296
|
+
puts "The image has #{i.columns} columns and #{i.rows} rows." »
|
1297
|
+
The image has 127 columns and 120 rows.
|
1298
|
+
</pre>
|
1299
|
+
|
1300
|
+
<h4>See also</h4><a href="#read">read</a>
|
1301
|
+
|
1302
|
+
<h4>Magick API</h4>
|
1303
|
+
|
1304
|
+
<p>PingImage</p>
|
1305
|
+
</div>
|
1306
|
+
|
1307
|
+
<div class="sig">
|
1308
|
+
<h3 id="quantize">quantize</h3>
|
1309
|
+
|
1310
|
+
<p><span class="arg">imagelist.</span>quantize(nc=256,
|
1311
|
+
colorspace=<code>Magick::RGBColorspace</code>,
|
1312
|
+
dither=<code>true</code>, tree_depth=0,
|
1313
|
+
measure_error=<code>false</code>) ->
|
1314
|
+
<em>anImageList</em></p>
|
1315
|
+
</div>
|
1316
|
+
|
1317
|
+
<div class="desc">
|
1318
|
+
<h4>Description</h4>
|
1319
|
+
|
1320
|
+
<p class="imquote">Analyzes the colors within a set of
|
1321
|
+
reference images and chooses a fixed number of colors to
|
1322
|
+
represent the set. The goal of the algorithm is to minimize the
|
1323
|
+
difference between the input and output images while minimizing
|
1324
|
+
the processing time.</p>
|
1325
|
+
|
1326
|
+
<h4>Arguments</h4>
|
1327
|
+
|
1328
|
+
<dl>
|
1329
|
+
<dt>nc</dt>
|
1330
|
+
|
1331
|
+
<dd>The maximum number of colors to use in the output images.
|
1332
|
+
Must be less than or equal to <a href=
|
1333
|
+
"constants.html#Miscellaneous_constants">MaxRGB</a>.</dd>
|
1334
|
+
|
1335
|
+
<dt>colorspace</dt>
|
1336
|
+
|
1337
|
+
<dd class="imquote">The <a href=
|
1338
|
+
"constants.html#ColorspaceType">colorspace</a> to quantize
|
1339
|
+
in. Color reduction, by default, takes place in the RGB color
|
1340
|
+
space. Empirical evidence suggests that distances in color
|
1341
|
+
spaces such as YUV or YIQ correspond to perceptual color
|
1342
|
+
differences more closely than do distances in RGB space. The
|
1343
|
+
Transparent color space behaves uniquely in that it preserves
|
1344
|
+
the matte channel of the image if it exists.</dd>
|
1345
|
+
|
1346
|
+
<dt>dither</dt>
|
1347
|
+
|
1348
|
+
<dd class="imquote">Apply Floyd/Steinberg error diffusion to
|
1349
|
+
the image. When the size of the color palette is less than
|
1350
|
+
the image colors, this trades off spacial resolution for
|
1351
|
+
color resolution by dithering to achieve a similar looking
|
1352
|
+
image.</dd>
|
1353
|
+
|
1354
|
+
<dt>tree_depth</dt>
|
1355
|
+
|
1356
|
+
<dd class="imquote">Specify the tree depth to use while
|
1357
|
+
quantizing. The values 0 and 1 support automatic tree depth
|
1358
|
+
determination. The tree depth may be forced via values
|
1359
|
+
ranging from two to eight. The ideal tree depth depends on
|
1360
|
+
the characteristics of the input image, and may be determined
|
1361
|
+
through experimentation.</dd>
|
1362
|
+
|
1363
|
+
<dt>measure_error</dt>
|
1364
|
+
|
1365
|
+
<dd><span class="imquote">Calculate quantization errors when
|
1366
|
+
quantizing the image.</span> Stores the results for each
|
1367
|
+
image in the imagelist <a href=
|
1368
|
+
"imageattrs.html#Image.mean_error_per_pixel">mean_error_per_pixel</a>,
|
1369
|
+
<a href=
|
1370
|
+
"imageattrs.html#Image.normalized_maximum_error">normalized_maximum_error</a>,
|
1371
|
+
and <a href=
|
1372
|
+
"imageattrs.html#Image.normalized_mean_error">normalized_mean_error</a>
|
1373
|
+
attributes. Stores the number of colors used for the image in
|
1374
|
+
the <a href=
|
1375
|
+
"imageattrs.html#Image.total_colors">total_colors</a>
|
1376
|
+
attribute.</dd>
|
1377
|
+
</dl>
|
1378
|
+
|
1379
|
+
<h4>Returns</h4>
|
1380
|
+
|
1381
|
+
<p>A new imagelist containing quantized copies of the images in
|
1382
|
+
the original image.</p>
|
1383
|
+
|
1384
|
+
<h4>Example</h4>
|
1385
|
+
|
1386
|
+
<p>This example shows the effect of quantizing 3 images to a
|
1387
|
+
set of 16 colors in the RGB colorspace. Mouse over the image to
|
1388
|
+
see the images before quantizing.</p>
|
1389
|
+
|
1390
|
+
<p class="rollover"><a href=
|
1391
|
+
"javascript:popup('quantize-m.rb.html')"><img src=
|
1392
|
+
"ex/quantize-m_after.jpg" alt="quantize example" title=
|
1393
|
+
"Click to see the example script" onmouseover=
|
1394
|
+
"this.src='ex/quantize-m_before.jpg'" onmouseout=
|
1395
|
+
"this.src='ex/quantize-m_after.jpg'" /></a> <img src=
|
1396
|
+
"ex/images/spin.gif" alt="" class="spin" style="left: 505px;"
|
1397
|
+
title="Mouse over the example to see the original image" /></p>
|
1398
|
+
|
1399
|
+
<h4>See also</h4>
|
1400
|
+
|
1401
|
+
<p><a href="image3.html#quantize">Image#quantize</a></p>
|
1402
|
+
|
1403
|
+
<h4>Magick API</h4>
|
1404
|
+
|
1405
|
+
<p>QuantizeImages</p>
|
1406
|
+
</div>
|
1407
|
+
|
1408
|
+
<div class="sig">
|
1409
|
+
<h3 id="read">read</h3>
|
1410
|
+
|
1411
|
+
<p><span class="arg">imagelist.</span>read(<span class=
|
1412
|
+
"arg">filename[, filename...]</span>) <span class=
|
1413
|
+
"arg">[ { optional arguments } ]</span> ->
|
1414
|
+
<em>self</em><br />
|
1415
|
+
<span class="arg">imagelist.</span>read(<span class=
|
1416
|
+
"arg">file[, file...]</span>) <span class="arg">[ {
|
1417
|
+
optional arguments } ]</span> -> <em>self</em></p>
|
1418
|
+
</div>
|
1419
|
+
|
1420
|
+
<div class="desc">
|
1421
|
+
<h4>Description</h4>
|
1422
|
+
|
1423
|
+
<p>Reads one or more image files and adds the images to the
|
1424
|
+
imagelist. After reading all the files, sets the <a href=
|
1425
|
+
"#scene">scene</a> number to the last image in the list.</p>
|
1426
|
+
|
1427
|
+
<p>The image files may be multi-frame (animated or layered)
|
1428
|
+
files. In this case <code>read</code> adds multiple images per
|
1429
|
+
file to the imagelist.</p>
|
1430
|
+
|
1431
|
+
<h4>Arguments</h4>
|
1432
|
+
|
1433
|
+
<p>One or more filenames or open file objects. You can also
|
1434
|
+
specify optional arguments to be used when reading the file(s)
|
1435
|
+
by setting <a href="info.html">Image::Info</a> attributes in
|
1436
|
+
the optional block.</p>
|
1437
|
+
|
1438
|
+
<h4>Returns</h4>
|
1439
|
+
|
1440
|
+
<p>self</p>
|
1441
|
+
|
1442
|
+
<h4>Example</h4>
|
1443
|
+
<pre>
|
1444
|
+
i = Magick::ImageList.new
|
1445
|
+
number = '0'
|
1446
|
+
4.times do
|
1447
|
+
i.read "images/Button_" + number + ".gif"
|
1448
|
+
number.succ!
|
1449
|
+
end
|
1450
|
+
</pre>
|
1451
|
+
|
1452
|
+
<p>Also see the <a href="#morph">morph</a> example and <a href=
|
1453
|
+
"javascript:popup('demo.rb.html')">demo.rb</a>.</p>
|
1454
|
+
|
1455
|
+
<h4>See also</h4>
|
1456
|
+
|
1457
|
+
<p><a href="image3.html#read">Image.read</a></p>
|
1458
|
+
|
1459
|
+
<h4>Magick API</h4>
|
1460
|
+
|
1461
|
+
<p>ReadImage</p>
|
1462
|
+
|
1463
|
+
<h4>Notes</h4>
|
1464
|
+
|
1465
|
+
<p>You can create images using ×Magick's built-in formats
|
1466
|
+
with the <code>read</code> method. See <a href=
|
1467
|
+
"imusage.html#builtin_formats">Built-in image formats</a>.</p>
|
1468
|
+
</div>
|
1469
|
+
|
1470
|
+
<div class="sig">
|
1471
|
+
<h3 id="to_blob">to_blob</h3>
|
1472
|
+
|
1473
|
+
<p><span class="arg">imagelist.</span>to_blob <span class=
|
1474
|
+
"arg">[ { optional arguments } ]</span> ->
|
1475
|
+
<em>aString</em></p>
|
1476
|
+
</div>
|
1477
|
+
|
1478
|
+
<div class="desc">
|
1479
|
+
<h4>Description</h4>
|
1480
|
+
|
1481
|
+
<p>Converts the images in the imagelist to a <em>blob</em>.
|
1482
|
+
<span class="imquote">A blob contains data that directly
|
1483
|
+
represent a particular image format in memory instead of on
|
1484
|
+
disk.</span></p>
|
1485
|
+
|
1486
|
+
<p>Control the format of the blob by setting <a href=
|
1487
|
+
"info.html">Image::Info</a> attributes in an associated
|
1488
|
+
block.</p>
|
1489
|
+
|
1490
|
+
<h4>Returns</h4>
|
1491
|
+
|
1492
|
+
<p>The blob in the form of a string</p>
|
1493
|
+
|
1494
|
+
<h4>Example</h4>
|
1495
|
+
<pre>
|
1496
|
+
i = Magick::ImageList.new "birthday.png"
|
1497
|
+
s = i.to_blob » a string representing the image.
|
1498
|
+
</pre>
|
1499
|
+
|
1500
|
+
<h4>See also</h4>
|
1501
|
+
|
1502
|
+
<p><a href="#from_blob">from_blob</a>, <a href=
|
1503
|
+
"image3.html#to_blob">Image#to_blob</a>, <a href=
|
1504
|
+
"image1.html#from_blob">Image.from_blob</a></p>
|
1505
|
+
|
1506
|
+
<h4>Magick API</h4>
|
1507
|
+
|
1508
|
+
<p>ImageListToBlob</p>
|
1509
|
+
</div>
|
1510
|
+
|
1511
|
+
<div class="sig">
|
1512
|
+
<h3 id="write">write</h3>
|
1513
|
+
|
1514
|
+
<p><span class="arg">imagelist.</span>write(<span class=
|
1515
|
+
"arg">filename</span>) <span class="arg">[ { optional
|
1516
|
+
arguments } ]</span> -> <em>self</em><br />
|
1517
|
+
<span class="arg">imagelist.</span>write(<span class=
|
1518
|
+
"arg">file</span>) <span class="arg">[ { optional
|
1519
|
+
arguments } ]</span> -> <em>self</em></p>
|
1520
|
+
</div>
|
1521
|
+
|
1522
|
+
<div class="desc">
|
1523
|
+
<h4>Description</h4>
|
1524
|
+
|
1525
|
+
<p>If the image format <a href="imusage.html#formats">indicated
|
1526
|
+
by the filename</a> supports multiple images per file (animated
|
1527
|
+
images), <code>write</code> writes all the images in the
|
1528
|
+
imagelist to a single file. Otherwise, <code>write</code>
|
1529
|
+
writes each image to a separate file.</p>
|
1530
|
+
|
1531
|
+
<p>Regardless of the original format, <code>write</code>
|
1532
|
+
converts the images to the format specified by the
|
1533
|
+
filename.</p>
|
1534
|
+
|
1535
|
+
<p>If the imagelist contains more than one image and the output
|
1536
|
+
format does not support multi-frame images, each image is
|
1537
|
+
written to a file that has the filename you specify followed by
|
1538
|
+
a period (.) and the scene number. You can change this behavior
|
1539
|
+
by embedding a %d, %0Nd, %o, %0No, %x, or %0Nx printf format
|
1540
|
+
specification in the file name.</p>
|
1541
|
+
|
1542
|
+
<h4>Arguments</h4>
|
1543
|
+
|
1544
|
+
<p>A filename or open file object. Indicate the desired image
|
1545
|
+
<a href="imusage.html#formats">format</a> either by the suffix
|
1546
|
+
(i.e. <code>.jpg</code>, <code>.png</code>) or the prefix
|
1547
|
+
(<code>ps:</code>) to the filename. If the argument is an open
|
1548
|
+
file object, you can specify a format for each image in the
|
1549
|
+
list by setting its <a href="imageattrs.html#format">format</a>
|
1550
|
+
attribute.</p>
|
1551
|
+
|
1552
|
+
<p>You can also specify optional arguments by setting <a href=
|
1553
|
+
"info.html">Image::Info</a> attributes in an associated
|
1554
|
+
block.</p>
|
1555
|
+
|
1556
|
+
<h4>Returns</h4>
|
1557
|
+
|
1558
|
+
<p>self, or <code>nil</code> if the format cannot be
|
1559
|
+
determined.</p>
|
1560
|
+
|
1561
|
+
<h4>Example</h4>
|
1562
|
+
<pre>
|
1563
|
+
# The PNG format does not support multi-frame files,
|
1564
|
+
# so each image is written to a separate file.
|
1565
|
+
i = Magick::ImageList.new "animated.gif"
|
1566
|
+
p i.length » 3 # contains 3 images
|
1567
|
+
i.write "test.png" » test.png.0
|
1568
|
+
» test.png.1
|
1569
|
+
» test.png.2
|
1570
|
+
# ×Magick's MIFF format does support multi-frame
|
1571
|
+
# files, so all 3 images are written to one file.
|
1572
|
+
i.write "animated.miff" » animated.miff
|
1573
|
+
</pre>
|
1574
|
+
|
1575
|
+
<h4>See also</h4>
|
1576
|
+
|
1577
|
+
<p><a href="image3.html#write">Image#write</a></p>
|
1578
|
+
|
1579
|
+
<h4>Magick API</h4>
|
1580
|
+
|
1581
|
+
<p>WriteImages</p>
|
1582
|
+
</div>
|
1583
|
+
|
1584
|
+
<p class="spacer"> </p>
|
1585
|
+
|
1586
|
+
<div class="nav">
|
1587
|
+
« <a href="magick.html">Prev</a> | <a href=
|
1588
|
+
"index.html">Contents</a> | <a href=
|
1589
|
+
"imageattrs.html">Next</a> »
|
1590
|
+
</div>
|
1591
|
+
</body>
|
1592
|
+
</html>
|