rmagick 1.15.17 → 2.0.0

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.

Files changed (108) hide show
  1. data/ChangeLog +78 -25
  2. data/README.html +117 -188
  3. data/README.txt +116 -181
  4. data/build_tarball.rake +205 -0
  5. data/doc/comtasks.html +2 -2
  6. data/doc/constants.html +118 -44
  7. data/doc/draw.html +57 -99
  8. data/doc/ex/adaptive_threshold.rb +1 -10
  9. data/doc/ex/add_noise.rb +4 -5
  10. data/doc/ex/axes.rb +1 -1
  11. data/doc/ex/bilevel_channel.rb +2 -13
  12. data/doc/ex/bounding_box.rb +3 -4
  13. data/doc/ex/channel.rb +6 -7
  14. data/doc/ex/clip_path.rb +11 -5
  15. data/doc/ex/color_histogram.rb +8 -20
  16. data/doc/ex/composite_layers.rb +53 -0
  17. data/doc/ex/fill_pattern.rb +26 -0
  18. data/doc/ex/get_multiline_type_metrics.rb +26 -37
  19. data/doc/ex/get_type_metrics.rb +25 -25
  20. data/doc/ex/images/notimplemented.gif +0 -0
  21. data/doc/ex/level.rb +1 -1
  22. data/doc/ex/matte_floodfill.rb +5 -6
  23. data/doc/ex/matte_replace.rb +5 -6
  24. data/doc/ex/negate_channel.rb +0 -10
  25. data/doc/ex/opacity.rb +3 -5
  26. data/doc/ex/polaroid.rb +4 -1
  27. data/doc/ex/posterize.rb +1 -12
  28. data/doc/ex/preview.rb +1 -8
  29. data/doc/ex/radial_blur.rb +1 -11
  30. data/doc/ex/raise.rb +1 -4
  31. data/doc/ex/random_threshold_channel.rb +4 -9
  32. data/doc/ex/sepiatone.rb +2 -9
  33. data/doc/ex/shadow.rb +12 -18
  34. data/doc/ex/sketch.rb +2 -9
  35. data/doc/ex/smile.rb +7 -7
  36. data/doc/ex/splice.rb +3 -10
  37. data/doc/ex/stegano.rb +5 -0
  38. data/doc/ex/threshold.rb +2 -2
  39. data/doc/ex/transpose.rb +1 -8
  40. data/doc/ex/transverse.rb +1 -8
  41. data/doc/ex/trim.rb +1 -2
  42. data/doc/ex/viewex.rb +4 -5
  43. data/doc/ex/vignette.rb +1 -8
  44. data/doc/ex/watermark.rb +1 -0
  45. data/doc/ex/wet_floor.rb +8 -14
  46. data/doc/ilist.html +301 -110
  47. data/doc/image1.html +362 -258
  48. data/doc/image2.html +429 -286
  49. data/doc/image3.html +418 -192
  50. data/doc/imageattrs.html +100 -39
  51. data/doc/imusage.html +26 -21
  52. data/doc/index.html +52 -93
  53. data/doc/info.html +160 -64
  54. data/doc/magick.html +37 -71
  55. data/doc/optequiv.html +155 -61
  56. data/doc/rvg.html +3 -3
  57. data/doc/rvgclip.html +2 -2
  58. data/doc/rvggroup.html +2 -2
  59. data/doc/rvgimage.html +3 -3
  60. data/doc/rvgpattern.html +3 -3
  61. data/doc/rvgshape.html +2 -2
  62. data/doc/rvgstyle.html +2 -2
  63. data/doc/rvgtext.html +2 -2
  64. data/doc/rvgtspan.html +4 -4
  65. data/doc/rvgtut.html +4 -4
  66. data/doc/rvguse.html +3 -3
  67. data/doc/rvgxform.html +2 -2
  68. data/doc/struct.html +26 -29
  69. data/doc/usage.html +99 -48
  70. data/examples/crop_with_gravity.rb +46 -0
  71. data/examples/demo.rb +2 -2
  72. data/examples/histogram.rb +11 -11
  73. data/examples/identify.rb +45 -45
  74. data/examples/spinner.rb +3 -2
  75. data/ext/RMagick/MANIFEST +7 -8
  76. data/ext/RMagick/extconf.rb +242 -0
  77. data/ext/RMagick/rmagick.h +136 -222
  78. data/ext/RMagick/rmdraw.c +226 -229
  79. data/ext/RMagick/rmfill.c +69 -118
  80. data/ext/RMagick/rmilist.c +234 -94
  81. data/ext/RMagick/rmimage.c +1719 -2564
  82. data/ext/RMagick/rminfo.c +433 -619
  83. data/ext/RMagick/rmmain.c +249 -487
  84. data/ext/RMagick/rmutil.c +344 -563
  85. data/lib/RMagick.rb +414 -358
  86. data/lib/rvg/clippath.rb +2 -2
  87. data/lib/rvg/container.rb +2 -2
  88. data/lib/rvg/describable.rb +2 -2
  89. data/lib/rvg/embellishable.rb +2 -2
  90. data/lib/rvg/misc.rb +3 -3
  91. data/lib/rvg/paint.rb +2 -7
  92. data/lib/rvg/pathdata.rb +2 -2
  93. data/lib/rvg/rvg.rb +2 -2
  94. data/lib/rvg/stretchable.rb +2 -14
  95. data/lib/rvg/stylable.rb +2 -2
  96. data/lib/rvg/text.rb +2 -2
  97. data/lib/rvg/transformable.rb +2 -2
  98. data/lib/rvg/units.rb +2 -2
  99. data/{metaconfig.in → metaconfig} +0 -1
  100. data/post-setup.rb +1 -1
  101. data/rmagick.gemspec +6 -9
  102. metadata +41 -49
  103. data/Makefile.in +0 -42
  104. data/configure +0 -12358
  105. data/configure.ac +0 -791
  106. data/ext/RMagick/extconf.rb.in +0 -25
  107. data/ext/RMagick/rmagick_config.h.in +0 -285
  108. data/gem_extconf.rb +0 -42
@@ -6,14 +6,7 @@ require 'RMagick'
6
6
  # Compare this example with the vignette.rb script in the examples directory.
7
7
 
8
8
  img = Magick::Image.read('images/Flower_Hat.jpg').first
9
-
10
- begin
11
- vignette = img.vignette
12
- rescue NotImplementedError
13
- vignette = Magick::Image.read('images/notimplemented.gif').first
14
- vignette.resize!(img.columns, img.rows)
15
- end
16
-
9
+ vignette = img.vignette
17
10
  vignette.write('vignette.jpg')
18
11
 
19
12
  exit
@@ -7,6 +7,7 @@ img = Magick::Image.read("images/Flower_Hat.jpg").first
7
7
  # Make a watermark from the word "RMagick"
8
8
  mark = Magick::Image.new(140, 40) {self.background_color = "none"}
9
9
  gc = Magick::Draw.new
10
+
10
11
  gc.annotate(mark, 0, 0, 0, -5, "RMagick") do
11
12
  gc.gravity = Magick::CenterGravity
12
13
  gc.pointsize = 32
@@ -2,31 +2,25 @@
2
2
 
3
3
  require 'RMagick'
4
4
 
5
- if Magick::Magick_version =~ /ImageMagick/
6
- y = -15
7
- else
8
- y = 1
9
- end
10
5
 
11
6
  results = Magick::ImageList.new
12
7
 
13
8
  img = Magick::Image.new(270, 60)
14
- img.matte = true
15
9
 
16
10
  gc = Magick::Draw.new
17
- gc.annotate(img, 0, 0, 0, y, "RUBY!") do
11
+ gc.annotate(img, 0, 0, 0, -15, "RUBY!") do
18
12
  gc.fill = '#c00'
19
13
  gc.stroke = 'black'
20
14
  gc.stroke_width = 2
21
15
  gc.font_weight = Magick::BoldWeight
22
16
  gc.gravity = Magick::SouthGravity
23
- if RUBY_PLATFORM =~ /mswin32/
24
- gc.font_family = "Georgia"
25
- gc.pointsize = 76
26
- else
27
- gc.font_family = "times"
28
- gc.pointsize = 80
29
- end
17
+ if RUBY_PLATFORM =~ /mswin32/
18
+ gc.font_family = "Georgia"
19
+ gc.pointsize = 76
20
+ else
21
+ gc.font_family = "times"
22
+ gc.pointsize = 80
23
+ end
30
24
  end
31
25
 
32
26
  # Add a little bit of shading
@@ -4,9 +4,9 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml">
5
5
  <head>
6
6
  <meta name="generator" content=
7
- "HTML Tidy for Linux/x86 (vers 1st December 2004), see www.w3.org" />
7
+ "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
8
8
 
9
- <title>RMagick 1.15.17: class ImageList</title>
9
+ <title>RMagick 2.0.0: class ImageList</title>
10
10
  <meta http-equiv="Content-Type" content=
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
@@ -20,7 +20,7 @@
20
20
  </head>
21
21
 
22
22
  <body>
23
- <h6 id="header">RMagick 1.15.17 User's Guide and Reference</h6>
23
+ <h6 id="header">RMagick 2.0.0 User's Guide and Reference</h6>
24
24
 
25
25
  <div class="nav">
26
26
  &laquo;&nbsp;<a href="magick.html">Prev</a> | <a href=
@@ -28,9 +28,8 @@
28
28
  "imageattrs.html">Next</a>&nbsp;&raquo;
29
29
  </div>
30
30
 
31
- <h1>class ImageList <span class="superclass">&lt;
32
- Array</span><br />
33
- <span class="mixin">mixes in Comparable</span></h1>
31
+ <h1>class ImageList<br />
32
+ <span class="mixin">mixes in Comparable, Enumerable</span></h1>
34
33
 
35
34
  <div id="toc">
36
35
  <h2>Table of Contents</h2>
@@ -73,6 +72,8 @@
73
72
 
74
73
  <li><a href="#coalesce">coalesce</a></li>
75
74
 
75
+ <li><a href="#composite_layers">composite_layers</a></li>
76
+
76
77
  <li><a href="#copy">copy</a></li>
77
78
 
78
79
  <li><a href="#cur_image">cur_image</a></li>
@@ -98,13 +99,13 @@
98
99
  <li><a href="#map">map</a></li>
99
100
 
100
101
  <li><a href="#montage">montage</a></li>
102
+
103
+ <li><a href="#morph">morph</a></li>
101
104
  </ul>
102
105
  </div>
103
106
 
104
107
  <div class="toccol">
105
108
  <ul>
106
- <li><a href="#morph">morph</a></li>
107
-
108
109
  <li><a href="#mosaic">mosaic</a></li>
109
110
 
110
111
  <li><a href="#new_image">new_image</a></li>
@@ -117,6 +118,8 @@
117
118
 
118
119
  <li><a href="#read">read</a></li>
119
120
 
121
+ <li><a href="#to_a">to_a</a></li>
122
+
120
123
  <li><a href="#to_blob">to_blob</a></li>
121
124
 
122
125
  <li><a href="#write">write</a></li>
@@ -212,10 +215,9 @@ imagelist.delay = 20 # delay 1/5 of a second between images.
212
215
  <p>Sets the number of times an animated image should loop.</p>
213
216
 
214
217
  <p>The <a href="#animate">animate</a> method and the
215
- ImageMagick animate/GraphicsMagick gm utilities do not respect
216
- this number. Both will repeat the animation until you stop
217
- them. Mozilla (and presumably Netscape) do respect the
218
- value..</p>
218
+ ImageMagick animate command does not respect this number. Both
219
+ will repeat the animation until you stop them. Mozilla (and
220
+ presumably Netscape) do respect the value..</p>
219
221
 
220
222
  <h4>Arguments</h4>
221
223
 
@@ -287,10 +289,6 @@ imagelist.scene &raquo; 10
287
289
  establish the elapsed time between frames in an animation. By
288
290
  default the number of ticks per second is 100.</p>
289
291
 
290
- <p>This attribute is available only in ImageMagick 6.2.4 and
291
- later. Prior to this release the number of ticks per second is
292
- fixed at 100.</p>
293
-
294
292
  <h4>Example</h4>
295
293
  <pre>
296
294
  imagelist.ticks_per_second = 1000
@@ -308,16 +306,16 @@ imagelist.ticks_per_second = 1000
308
306
  <div class="desc">
309
307
  <h4>Description</h4>
310
308
 
311
- <p><code>ImageList</code> is a subclass of <code>Array</code>,
312
- so you can manipulate the images in an imagelist using almost
313
- all of the methods defined in <code>Array</code>. Typically
314
- these methods also update the scene number. The scene number
315
- will never exceed the number of images in the list, and if the
316
- imagelist contains no images the scene number will be
317
- <code>nil</code>.</p>
309
+ <p><code>ImageList</code> delegates many methods to
310
+ <code>Array</code>, so you can manipulate the images in an
311
+ imagelist using almost all of the methods defined in
312
+ <code>Array</code>. Typically these methods also update the
313
+ scene number. The scene number will never exceed the number of
314
+ images in the list, and if the imagelist contains no images the
315
+ scene number will be <code>nil</code>.</p>
318
316
 
319
- <p>Array methods defined in the ImageList class that would
320
- normally return an array return an ImageList.</p>
317
+ <p>Array methods that would normally return an array return an
318
+ ImageList.</p>
321
319
 
322
320
  <p>Most array methods keep the current image current. If the
323
321
  method moves the current image to a new position, the method
@@ -375,7 +373,12 @@ imagelist.ticks_per_second = 1000
375
373
 
376
374
  <p>Adding anything other than a image to an imagelist has
377
375
  undefined results. Most of the time RMagick will raise an
378
- ArgumentError exception.</p>
376
+ ArgumentError exception. For example, if you call
377
+ <code>collect!</code> on an imagelist you should make sure that
378
+ the members of theimagelist remain images. If you need to
379
+ replace images in an imagelist with non-image objects, convert
380
+ the imagelist to an array with the <code>to_a</code> method,
381
+ then modify the array.</p>
379
382
 
380
383
  <p>The <code>assoc</code>, <code>flatten</code>,
381
384
  <code>flatten!</code>, <code>join</code>, <code>pack</code>,
@@ -535,17 +538,15 @@ imagelist.animate { self.server_name = "other:0.0" }
535
538
  <img style="display:none" id="notaveraged" onmouseout=
536
539
  "this.style.display='none'; averaged.style.display=''; averagedspin.style.display='';"
537
540
  title="Click to see the example script" src=
538
- "ex/average_before.gif" alt="average example"
539
- /><!--
541
+ "ex/average_before.gif" alt="average example" /><!--
540
542
  This img tag displays the averaged image when the mouse is not over
541
543
  --><img style="display:" id=
542
544
  "averaged" onmouseover=
543
545
  "this.style.display='none'; notaveraged.style.display=''; averagedspin.style.display='none';"
544
- src="ex/average_after.gif" alt="average example"
545
- /></a> <img src="ex/images/spin.gif" alt="" class=
546
- "spin" style="left:131px; display:" id="averagedspin" title=
547
- "Mouse over the example to see the 3 original images"
548
- /></p>
546
+ src="ex/average_after.gif" alt="average example" /></a>
547
+ <img src="ex/images/spin.gif" alt="" class="spin" style=
548
+ "left:131px; display:" id="averagedspin" title=
549
+ "Mouse over the example to see the 3 original images" /></p>
549
550
 
550
551
  <h4>Magick API</h4>
551
552
 
@@ -563,7 +564,7 @@ imagelist.animate { self.server_name = "other:0.0" }
563
564
  <h4>Description</h4>
564
565
 
565
566
  <p>Same as <a href="#dup">dup</a>, but the frozen state of the
566
- original is propagated to the copy.</p>
567
+ original is propogated to the copy.</p>
567
568
 
568
569
  <h4>Returns</h4>
569
570
 
@@ -611,16 +612,85 @@ imagelist.animate { self.server_name = "other:0.0" }
611
612
  "this.src='ex/coalesce.gif'" src="ex/coalesce.gif" alt=
612
613
  "coalesce example" title=
613
614
  "Click the image to see the example script" /></a><img src=
614
- "ex/images/spin.gif" alt="" class="spin" style="left:159px"
615
+ "ex/images/spin.gif" alt="" class="spin" style="left:165px"
615
616
  title="Mouse over the example to see the animation" /></p>
616
617
 
617
- <h4>See also</h4><a href="#flatten_images">flatten_images</a>
618
+ <h4>See also</h4>
619
+
620
+ <p><a href="#flatten_images">flatten_images</a>, <a href=
621
+ "#optimize_layers">optimize_layers</a></p>
618
622
 
619
623
  <h4>Magick API</h4>
620
624
 
621
625
  <p>CoalesceImages</p>
622
626
  </div>
623
627
 
628
+ <div class="sig">
629
+ <h3 id="composite_layers">composite_layers</h3>
630
+
631
+ <p><span class=
632
+ "arg">destination_list</span>.composite_layers(<span class=
633
+ "arg">source_list</span>, <span class=
634
+ "arg">operator</span>=<code>OverCompositeOp</code>) -&gt;
635
+ <em>anImageList</em></p>
636
+ </div>
637
+
638
+ <div class="desc">
639
+ <h4>Description</h4>
640
+
641
+ <p>An image from <span class="arg">source_list</span> is
642
+ composited over an image from <span class=
643
+ "arg">destination_list</span> until one list is finished. Use
644
+ the <a href="imageattrs.html#geometry">geometry</a> and
645
+ <a href="imageattrs.html#gravity">gravity</a> attributes of the
646
+ first image in <span class="arg">destination_list</span> to
647
+ position the source images over the destination images.
648
+ <span class="imquote">Unlike a normal composite operation, the
649
+ canvas offset is also included to the composite positioning. If
650
+ one of the image lists only contains one image, that image is
651
+ applied to all the images in the other image list, regardless
652
+ of which list it is. In this case it is the image meta-data of
653
+ the list which preserved.</span></p>
654
+
655
+ <h4>Arguments</h4>
656
+
657
+ <p>The optional <span class="arg">operator</span> argument
658
+ specifies a <a href=
659
+ "constants.html#CompositeOperator">CompositeOperator</a> to use
660
+ for the compositing operations.</p>
661
+
662
+ <h4>Returns</h4>
663
+
664
+ <p>An imagelist</p>
665
+
666
+ <h4>Example</h4>
667
+
668
+ <p>This example is an animated GIF. Mouse over the image to
669
+ start the animation.</p>
670
+
671
+ <p class="rollover"><a href=
672
+ "javascript:popup('composite_layers.rb.html')"><img onmouseover="this.src='ex/composite_layers.gif'"
673
+ onmouseout="this.src='ex/composite_layers1.gif'" src=
674
+ "ex/composite_layers1.gif" alt="composite_layers example"
675
+ title="Click the image to see the example script" /></a><img src="ex/images/spin.gif"
676
+ alt="" class="spin" style="left:105px" title=
677
+ "Mouse over the example to see the animation" /></p>
678
+
679
+ <h4>Notes</h4>
680
+
681
+ <p>This method is equivalent to the <code>-layers
682
+ Composite</code> option of ImageMagick's <code>convert</code>
683
+ command. See the <a href=
684
+ "http://www.imagemagick.org/Usage/anim_mods/#composite">Layers
685
+ Composition</a> section in <a href=
686
+ "http://www.imagemagick.org/Usage/">Examples of ImageMagick
687
+ Usage</a> for more information.</p>
688
+
689
+ <h4>See also</h4>
690
+
691
+ <p><a href="#optimize_layers">optimize_layers</a></p>
692
+ </div>
693
+
624
694
  <div class="sig">
625
695
  <h3 id="copy">copy</h3>
626
696
 
@@ -644,8 +714,10 @@ imagelist.animate { self.server_name = "other:0.0" }
644
714
  imagelist2 = imagelist1.copy
645
715
  </pre>
646
716
 
647
- <h4>See also</h4><a href="image1.html#copy">Image#copy</a>,
648
- <a href="#clone">clone</a>, <a href="#dup">dup</a>
717
+ <h4>See also</h4>
718
+
719
+ <p><a href="image1.html#copy">Image#copy</a>, <a href=
720
+ "#clone">clone</a>, <a href="#dup">dup</a></p>
649
721
  </div>
650
722
 
651
723
  <div class="sig">
@@ -689,7 +761,7 @@ imagelist2 = imagelist1.copy
689
761
  successor. The resulting imagelist usually produces a much
690
762
  smaller file.</p>
691
763
 
692
- <p>The <code>deconstruct</code> method starts by copying the
764
+ <p>The <code>desconstruct</code> method starts by copying the
693
765
  first image in the list to the output imagelist. Then, for each
694
766
  pair of images, <code>deconstruct</code> computes the smallest
695
767
  rectangle that encompasses all the changes between the first
@@ -798,11 +870,12 @@ imagelist2 = imagelist1.copy
798
870
 
799
871
  <h4>See also</h4>
800
872
 
801
- <p><a href="#coalesce">coalesce</a></p>
873
+ <p><a href="#coalesce">coalesce</a>, <a href=
874
+ "#optimize_layers">optimize_layers</a></p>
802
875
 
803
876
  <h4>Magick API</h4>
804
877
 
805
- <p>FlattenImageList</p>
878
+ <p>MergeImageLaters with the FlattenLayer method.</p>
806
879
  </div>
807
880
 
808
881
  <div class="sig">
@@ -1182,8 +1255,8 @@ geometry is "120x120+4+3&gt;".
1182
1255
  <dd>
1183
1256
  A image to be tiled on the background of the composite
1184
1257
  image. If present, this attribute overrides the background
1185
- color. For example, to use &times;Magick's built-in
1186
- "granite" texture as the background, use:
1258
+ color. For example, to use ImageMagick's built-in "granite"
1259
+ texture as the background, use:
1187
1260
  <pre>
1188
1261
  self.texture = Magick::Image.read("granite:").first
1189
1262
  </pre>
@@ -1314,11 +1387,12 @@ img[2]['Label'] = "Mom's Birthday"
1314
1387
 
1315
1388
  <h4>See also</h4><a href="#coalesce">coalesce</a>, <a href=
1316
1389
  "#flatten_images">flatten_images</a>, <a href=
1317
- "#montage">montage</a>
1390
+ "#montage">montage</a>, <a href=
1391
+ "#optimize_images">optimize_images</a>
1318
1392
 
1319
1393
  <h4>Magick API</h4>
1320
1394
 
1321
- <p>MosaicImages</p>
1395
+ <p>MergeImageLayers with the MosaicLayer method.</p>
1322
1396
  </div>
1323
1397
 
1324
1398
  <div class="sig">
@@ -1380,76 +1454,175 @@ imagelist.new_image(100, 100) { self.background_color = "red" }
1380
1454
  the <code>-layers</code> option in ImageMagick's
1381
1455
  <code>mogrify</code> command.</p>
1382
1456
 
1383
- <p>With the CompareAnyLayer, CompareClearLayer, and
1384
- CompareOverlayLayer arguments, <code>optimize_layers</code>
1385
- <span class="imquote">compares each image with the next in a
1386
- sequence and returns the minimum bounding region of all the
1387
- pixel differences (of the <code>LayerMethod</code> specified)
1388
- it discovers.</span></p>
1389
-
1390
- <p class="imquote">The images in the list <span class=
1391
- "imquote">do NOT have to be the same size, though it is best
1392
- that all the images are fully 'coalesced' (images are all the
1393
- same size, on a flattened canvas, and represent how an specific
1394
- frame should look is animated)</span></p>
1395
-
1396
- <p class="imquote">If images are not the same size as the page
1397
- canvas size of first image, then it is alpha composed using
1398
- 'Copy' onto the previous frame compared. That is the
1399
- differences only within the overlay area are looked at.</p>
1400
-
1401
- <p class="imquote">No dispose methods are applied, though this
1402
- does not matter for animations which are a fully coalesced
1403
- sequence of images.</p>
1404
-
1405
- <p>With OptimizeLayer, <code>optimize_layers</code>
1406
- <span class="imquote">compares each image the GIF disposed
1407
- forms of the previous image in the sequence. From this it
1408
- attempts to select the smallest cropped image to replace each
1409
- frame, while preserving the results of the
1410
- animation.</span></p>
1411
-
1412
- <p>OptimizePlusLayer is the same as OptimizeLayers,
1413
- <span class="imquote">but may also add or even remove extra
1414
- frames in the animation, if it improves the total number of
1415
- pixels in the resulting GIF animation.</span></p>
1416
-
1417
- <p>With DisposeLayer, <code>optimize_layers</code> <span class=
1418
- "imquote">returns the coalesced frames of a GIF animation as it
1419
- would appear after the GIF dispose method of that frame has
1420
- been applied. That is it returns the appearance of each frame
1421
- before the next is overlaid.</span></p>
1422
-
1423
1457
  <p>The <code>optimize_layers</code> method corresponds to the
1424
1458
  <code>-layers</code> option on ImageMagick's
1425
1459
  <code>convert</code> and <code>mogrify</code> commands. Anthony
1426
1460
  Thyssen's excellent <a href=
1427
- "http://www.cit.gu.edu.au/~anthony/graphics/imagick6">Examples
1428
- of ImageMagick Usage</a> site has very detailed <a href=
1429
- "http://www.cit.gu.edu.au/~anthony/graphics/imagick6/anim_basics/#optimize">
1430
- information and examples</a> of the <code>-layers</code> option
1431
- and and the optimization methods .</p>
1461
+ "http://www.imagemagick.org/Usage/">Examples of ImageMagick
1462
+ Usage</a> site has very detailed <a href=
1463
+ "http://www.imagemagick.org/Usage/anim_opt/">information and
1464
+ examples</a> of the <code>-layers</code> option and and the
1465
+ optimization methods .</p>
1432
1466
 
1433
1467
  <h4>Arguments</h4>
1434
1468
 
1435
- <p>One of the following <code>MagickLayerMethod</code>
1436
- values:</p>
1469
+ <p>One of the following ImageLayerMethod enum values:</p>
1437
1470
 
1438
- <ul>
1439
- <li>CoalesceLayer</li>
1440
-
1441
- <li>CompareAnyLayer</li>
1442
-
1443
- <li>CompareClearLayer</li>
1444
-
1445
- <li>CompareOverlayLayer</li>
1446
-
1447
- <li>DisposeLayer</li>
1471
+ <dl>
1472
+ <dt>CoalesceLayer</dt>
1473
+
1474
+ <dd class="imquote">Equivalent to [<a href=
1475
+ "#coalesce">coalesce</a>]. Apply the GIF disposal methods set
1476
+ in the current image sequence to form a fully defined
1477
+ animation sequence without, as it should be displayed.
1478
+ Effectively converting a GIF animation into a 'film strip'
1479
+ like animation.</dd>
1480
+
1481
+ <dt>CompareAnyLayer</dt>
1482
+
1483
+ <dd class="imquote">Crop the second and later frames to the
1484
+ smallest rectangle that contains all the differences between
1485
+ the two images. No GIF disposal methods are taken into
1486
+ account. This is exactly the same as [<a href=
1487
+ "#deconstruct">deconstruct</a>], and does not preserve a
1488
+ animation's normal working, especially when a animation used
1489
+ GIF disposal methods such as 'Previous' or 'Background'.</dd>
1490
+
1491
+ <dt>CompareClearLayer</dt>
1492
+
1493
+ <dd class="imquote">As [CompareAnyLayer] but crop to the
1494
+ bounds of any opaque pixels which become transparent in the
1495
+ second frame. That is the smallest image needed to mask or
1496
+ erase pixels for the next frame.</dd>
1497
+
1498
+ <dt>CompareOverlayLayer</dt>
1499
+
1500
+ <dd class="imquote">As [CompareAnyLayer] but crop to pixels
1501
+ that add extra color to the next image, as a result of
1502
+ overlaying color pixels. That is the smallest single overlaid
1503
+ image to add or change colors. This can, be used with the
1504
+ -compose alpha composition method 'change-mask', to reduce
1505
+ the image to just the pixels that need to be overlaid.</dd>
1506
+
1507
+ <dt>DisposeLayer</dt>
1508
+
1509
+ <dd class="imquote">This is like [CoalesceLayer] but shows
1510
+ the look of the animation after the GIF disposal method has
1511
+ been applied, before the next sub-frame image is overlaid.
1512
+ That is the 'dispose' image that results from the application
1513
+ of the GIF disposal method. This allows you to check what is
1514
+ going wrong with a particular animation you may be
1515
+ developing.</dd>
1516
+
1517
+ <dt>FlattenLayer</dt>
1518
+
1519
+ <dd><span class="imquote">Create a canvas the size of the
1520
+ first images virtual canvas using the current background
1521
+ color, and compose each image in turn onto that canvas.
1522
+ Images falling outside that canvas will be clipped. Final
1523
+ image will have a zero virtual canvas offset. This is usally
1524
+ used as one of the final 'image layering' operations
1525
+ overlaying all the prepared image layers into a final image.
1526
+ For a single image this method can also be used to fillout a
1527
+ virtual canvas with real pixels, or to underlay a opaque
1528
+ color to remove transparency from an image.</span> This
1529
+ method corresponds to <a href=
1530
+ "#flatten_images">flatten_images</a>, above.</dd>
1531
+
1532
+ <dt>MosaicLayer</dt>
1533
+
1534
+ <dd><span class="imquote">As FlattenLayer method but
1535
+ expanding the initial canvas size of the first image so as to
1536
+ hold all the image layers. However as a virtual canvas is
1537
+ 'locked' to the origin, by definition, image layers with a
1538
+ negative offsets will still be clipped by the top and left
1539
+ edges. This method is commonly used to layout individual
1540
+ image using various offset but without knowning the final
1541
+ canvas size. The resulting image will, like FlattenLayer not
1542
+ have any virtual offset, so can be saved to any image file
1543
+ format.</span> This method corresponds to <a href=
1544
+ "#mosaic">mosaic</a>, above.</dd>
1545
+
1546
+ <dt>OptimizeImageLayer</dt>
1547
+
1548
+ <dd class="imquote">Optimize a coalesced animation into GIF
1549
+ animation by reducing the number of pixels per frame as much
1550
+ as possible by attempting to pick the best GIF disposal
1551
+ method to use, while ensuring the result will continue to
1552
+ animate properly. There is no guarantee that the best
1553
+ optimization will be found. But then no reasonably fast GIF
1554
+ optimization algorithm can do this. However this does seem to
1555
+ do better than most other GIF frame optimizers seen.</dd>
1556
+
1557
+ <dt>OptimizeLayer</dt>
1558
+
1559
+ <dd class="imquote">Optimize a coalesced animation into GIF
1560
+ animation using a number of general techniques. This is
1561
+ currently a short cut to apply both the [OptimizeImageLayer]
1562
+ and [OptimizeTransLayer] methods but will expand to include
1563
+ other methods.</dd>
1564
+
1565
+ <dt>OptimizePlusLayer</dt>
1566
+
1567
+ <dd class="imquote">As [OptimizeImageLayer] but attempt to
1568
+ improve the overall optimization by adding extra frames to
1569
+ the animation, without changing the final look or timing of
1570
+ the animation. The frames are added to attempt to separate
1571
+ the clearing of pixels from the overlaying of new additional
1572
+ pixels from one animation frame to the next. If this does not
1573
+ improve the optimization (for the next frame only), it will
1574
+ fall back to the results of the previous normal
1575
+ [OptimizeImageLayer] technique. There is the possibility that
1576
+ the change in the disposal style will result in a worsening
1577
+ in the optimization of later frames, though this is unlikely.
1578
+ In other words there no guarantee that it is better than the
1579
+ normal 'optimize-frame' technique.</dd>
1580
+
1581
+ <dt>OptimizeTransLayer</dt>
1582
+
1583
+ <dd class="imquote">Given a GIF animation, replace any pixel
1584
+ in the sub-frame overlay images with transparency, if it does
1585
+ not change the resulting animation by more than the current
1586
+ fuzz factor. This should allow a existing frame optimized GIF
1587
+ animation to compress into a smaller file size due to larger
1588
+ areas of one (transparent) color rather than a pattern of
1589
+ multiple colors repeating the current disposed image of the
1590
+ last frame.</dd>
1591
+
1592
+ <dt>RemoveDupsLayer</dt>
1593
+
1594
+ <dd class="imquote">Remove (and merge time delays) of
1595
+ duplicate consecutive images, so as to simplify layer
1596
+ overlays of coalesced animations. Usally this is a result of
1597
+ using a constant time delay across the whole animation, or
1598
+ after a larger animation was split into smaller
1599
+ sub-animations. The duplicate frames could also have been
1600
+ used as part of some frame optimization methods.</dd>
1601
+
1602
+ <dt>RemoveZeroLayer</dt>
1603
+
1604
+ <dd class="imquote">Remove any image with a zero time delay,
1605
+ unless ALL the images have a zero time delay (and is not a
1606
+ proper timed animation, a warning is then issued). In a GIF
1607
+ animation, such images are usually frames which provide
1608
+ partial intermediary updates between the frames that are
1609
+ actually displayed to users. These frames are usally added
1610
+ for improved frame optimization in GIF animations.</dd>
1611
+ </dl>
1448
1612
 
1449
- <li>OptimizeLayer</li>
1613
+ <p>Some of these values are not supported by older versions of
1614
+ ImageMagick. To see what values are available, enter the
1615
+ following code in irb:</p>
1616
+ <pre>
1617
+ Magick::ImageLayerMethod.values {|v| puts v}
1618
+ </pre>
1450
1619
 
1451
- <li>OptimizePlusLayer</li>
1452
- </ul>
1620
+ <p>In releases of ImageMagick before 6.3.6, this type was
1621
+ called MagickLayerMethod, so you may need to use this
1622
+ instead:</p>
1623
+ <pre>
1624
+ Magick::MagickLayerMethod.values {|v| puts v}
1625
+ </pre>
1453
1626
 
1454
1627
  <h4>Returns</h4>
1455
1628
 
@@ -1457,6 +1630,8 @@ imagelist.new_image(100, 100) { self.background_color = "red" }
1457
1630
 
1458
1631
  <h4>See also</h4>
1459
1632
 
1633
+ <p><a href="#composite_layers">composite_layers</a></p>
1634
+
1460
1635
  <p><a href="#deconstruct">deconstruct</a> is an alias for
1461
1636
  <code>optimize_layers</code> with the
1462
1637
  <code>CompareAnyLayer</code> argument.</p>
@@ -1467,8 +1642,7 @@ imagelist.new_image(100, 100) { self.background_color = "red" }
1467
1642
 
1468
1643
  <h4>Magick API</h4>
1469
1644
 
1470
- <p>OptimizeImageLayers, CompareImageLayers (available in
1471
- ImageMagick 6.2.6)</p>
1645
+ <p>OptimizeImageLayers, CompareImageLayers</p>
1472
1646
  </div>
1473
1647
 
1474
1648
  <div class="sig">
@@ -1540,7 +1714,7 @@ puts "The image has #{i.columns} columns and #{i.rows} rows." &raquo;
1540
1714
 
1541
1715
  <dd>The maximum number of colors to use in the output images.
1542
1716
  Must be less than or equal to <a href=
1543
- "constants.html#Miscellaneous_constants">MaxRGB</a>.</dd>
1717
+ "constants.html#Miscellaneous_constants">QuantumRange</a>.</dd>
1544
1718
 
1545
1719
  <dt>colorspace</dt>
1546
1720
 
@@ -1670,7 +1844,7 @@ number = '0'
1670
1844
 
1671
1845
  <h4>Notes</h4>
1672
1846
 
1673
- <p>You can create images using &times;Magick's built-in formats
1847
+ <p>You can create images using ImageMagick's built-in formats
1674
1848
  with the <code>read</code> method. See <a href=
1675
1849
  "imusage.html#builtin_formats">Built-in image formats</a>.</p>
1676
1850
  </div>
@@ -1716,6 +1890,23 @@ s = i.to_blob &raquo; a string representing the image.
1716
1890
  <p>ImageListToBlob</p>
1717
1891
  </div>
1718
1892
 
1893
+ <div class="sig">
1894
+ <h3 id="to_a">to_a</h3>
1895
+
1896
+ <p><span class="arg">imagelist</span>.to_a -&gt;
1897
+ <em>anArray</em></p>
1898
+ </div>
1899
+
1900
+ <div class="desc">
1901
+ <h4>Description</h4>
1902
+
1903
+ <p>Returns an array containing all the images in the list.</p>
1904
+
1905
+ <h4>Returns</h4>
1906
+
1907
+ <p>An array</p>
1908
+ </div>
1909
+
1719
1910
  <div class="sig">
1720
1911
  <h3 id="write">write</h3>
1721
1912
 
@@ -1775,7 +1966,7 @@ p i.length &raquo; 3 # contains 3 images
1775
1966
  i.write "test.png" &raquo; test.png.0
1776
1967
  &raquo; test.png.1
1777
1968
  &raquo; test.png.2
1778
- # &times;Magick's MIFF format does support multi-frame
1969
+ # ImageMagick's MIFF format does support multi-frame
1779
1970
  # files, so all 3 images are written to one file.
1780
1971
  i.write "animated.miff" &raquo; animated.miff
1781
1972
  </pre>