rmagick 1.9.0 → 1.9.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.

@@ -4,7 +4,7 @@
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 September 2004), see www.w3.org" />
7
+ "HTML Tidy for Mac OS X (vers 1st September 2004), see www.w3.org" />
8
8
 
9
9
  <title>RMagick: class Image (instance methods, part 2)</title>
10
10
  <meta http-equiv="Content-Type" content=
@@ -142,7 +142,8 @@
142
142
 
143
143
  <li><a href="#normalize">normalize</a></li>
144
144
 
145
- <li><a href="#normalize_channel">normalize_channel</a></li>
145
+ <li><a href=
146
+ "#normalize_channel">normalize_channel</a></li>
146
147
 
147
148
  <li><a href="#oil_paint">oil_paint</a></li>
148
149
 
@@ -191,9 +192,10 @@
191
192
  "ex/enhance.jpg" alt="enhance example" title=
192
193
  "Click to see the example script" /></a></p>
193
194
 
194
- <h4>See also</h4><p><a href=
195
- "image2.html#median_filter">median_filter</a>, <a href=
196
- "image2.html#reduce_noise">reduce_noise</a>, <a href=
195
+ <h4>See also</h4>
196
+
197
+ <p><a href="image2.html#median_filter">median_filter</a>,
198
+ <a href="image2.html#reduce_noise">reduce_noise</a>, <a href=
197
199
  "image3.html#unsharp_mask">unsharp_mask</a></p>
198
200
 
199
201
  <h4>Magick API</h4>
@@ -249,8 +251,9 @@
249
251
 
250
252
  <h4>Returns</h4>self
251
253
 
252
- <h4>See also</h4><p><a href=
253
- "image1.html#color_reset_bang">color_reset!</a></p>
254
+ <h4>See also</h4>
255
+
256
+ <p><a href="image1.html#color_reset_bang">color_reset!</a></p>
254
257
 
255
258
  <h4>Magick API</h4>
256
259
 
@@ -304,14 +307,15 @@
304
307
  scanline = img.export_pixels(0, r, img.columns, 1, "RGB");
305
308
  </pre>
306
309
 
307
- <h4>See also</h4><p><a href="image1.html#dispatch">dispatch</a>,
308
- <a href="#import_pixels">import_pixels</a>, <a href=
310
+ <h4>See also</h4>
311
+
312
+ <p><a href="image1.html#dispatch">dispatch</a>, <a href=
313
+ "#import_pixels">import_pixels</a>, <a href=
309
314
  "#get_pixels">get_pixels</a></p>
310
315
 
311
316
  <h4>Magick API</h4>
312
317
 
313
- <p>ExportImagePixels (available in ImageMagick 5.5.7 and
314
- GraphicsMagick 1.1)</p>
318
+ <p>ExportImagePixels</p>
315
319
 
316
320
  <h4>Note</h4>
317
321
 
@@ -484,17 +488,19 @@ scanline = img.export_pixels(0, r, img.columns, 1, "RGB");
484
488
  <img style="padding:25px; display:none" id="frameless"
485
489
  onmouseout="this.style.display='none';framed.style.display='';"
486
490
  src="ex/images/Flower_Hat.jpg" alt="frame example" title=
487
- "Click to see the example script" /><!--
491
+ "Click to see the example script" /><!--
488
492
  This img tag displays the framed image when the mouse is not over
489
493
  --><img class="hide"
490
494
  id="framed" onmouseover=
491
495
  "this.style.display='none';frameless.style.display='';" src=
492
- "ex/frame.jpg" alt="frame example" /></a>
496
+ "ex/frame.jpg" alt="frame example" /></a>
493
497
  <img src="ex/images/spin.gif" alt="" style=
494
498
  "margin-bottom: 280px" title=
495
499
  "Mouse over the example to see the original image" /></p>
496
500
 
497
- <h4>See also</h4><p><a href="image1.html#border">border</a></p>
501
+ <h4>See also</h4>
502
+
503
+ <p><a href="image1.html#border">border</a></p>
498
504
 
499
505
  <h4>Magick API</h4>
500
506
 
@@ -538,13 +544,14 @@ scanline = img.export_pixels(0, r, img.columns, 1, "RGB");
538
544
 
539
545
  <p>A new image</p>
540
546
 
541
- <h4>See also</h4><p>The older <a href=
542
- "#gamma_correct">gamma_correct</a> method is implemented in
543
- terms of <code>gamma_channel</code>.</p>
547
+ <h4>See also</h4>
548
+
549
+ <p>The older <a href="#gamma_correct">gamma_correct</a> method
550
+ is implemented in terms of <code>gamma_channel</code>.</p>
544
551
 
545
552
  <h4>Magick API</h4>
546
553
 
547
- <p>GammaImageChannel (available in ImageMagick 6.0.0)</p>
554
+ <p>GammaImageChannel</p>
548
555
  </div>
549
556
 
550
557
  <div class="sig">
@@ -574,7 +581,9 @@ scanline = img.export_pixels(0, r, img.columns, 1, "RGB");
574
581
 
575
582
  <p>A new image</p>
576
583
 
577
- <h4>See also</h4><p><a href="#gamma_channel">gamma_channel</a></p>
584
+ <h4>See also</h4>
585
+
586
+ <p><a href="#gamma_channel">gamma_channel</a></p>
578
587
 
579
588
  <h4>Magick API</h4>
580
589
 
@@ -629,10 +638,11 @@ scanline = img.export_pixels(0, r, img.columns, 1, "RGB");
629
638
  "ex/images/spin.gif" alt="" class="spin" title=
630
639
  "Mouse over the example to see the original image" /></p>
631
640
 
632
- <h4>See also</h4><p><a href=
633
- "image1.html#blur_image">blur_image</a>, <a href=
634
- "#motion_blur">motion_blur</a>,
635
- <a href="image3.html#radial_blur">radial_blur</a></p>
641
+ <h4>See also</h4>
642
+
643
+ <p><a href="image1.html#blur_image">blur_image</a>, <a href=
644
+ "#motion_blur">motion_blur</a>, <a href=
645
+ "image3.html#radial_blur">radial_blur</a></p>
636
646
 
637
647
  <h4>Magick API</h4>
638
648
 
@@ -879,8 +889,8 @@ image.get_exif_by_number() &raquo;
879
889
 
880
890
  <p><span class="imquote">Converts an image to a PseudoClass
881
891
  grayscale representation with an optionally compressed and
882
- sorted colormap..</span> This method is available in
883
- GraphicsMagick 1.1.</p>
892
+ sorted colormap..</span> This method is only available in
893
+ GraphicsMagick 1.1 and later.</p>
884
894
 
885
895
  <h4>Arguments</h4>
886
896
 
@@ -961,16 +971,21 @@ image.get_exif_by_number() &raquo;
961
971
  <p><span class="arg">image</span>.import_pixels(<span class=
962
972
  "arg">x</span>, <span class="arg">y</span>, <span class=
963
973
  "arg">columns</span>, <span class="arg">rows</span>,
964
- <span class="arg">map</span>, <span class="arg">pixels</span>)
965
- -&gt; <em>image</em></p>
974
+ <span class="arg">map</span>, <span class="arg">pixels</span>,
975
+ <span class="arg">type</span>=Magick::CharPixel) -&gt;
976
+ <em>image</em></p>
966
977
  </div>
967
978
 
968
979
  <div class="desc">
969
980
  <h4>Description</h4>
970
981
 
971
982
  <p>Replaces the pixels in the specified rectangle with pixel
972
- data from the supplied array. This method is the reverse of
973
- <code>export_pixels</code>.</p>
983
+ data from the supplied array or string. When the <span class=
984
+ "arg">pixels</span> argument is an array of pixel data, this
985
+ method is the reverse of <code>export_pixels</code>. When the
986
+ <span class="arg">pixels</span> argument is a string,
987
+ <code>import_pixels</code> is ideal for loading very large
988
+ amounts of binary pixel data.</p>
974
989
 
975
990
  <h4>Arguments</h4>
976
991
 
@@ -994,11 +1009,64 @@ image.get_exif_by_number() &raquo;
994
1009
 
995
1010
  <dt>pixels</dt>
996
1011
 
997
- <dd>The pixel data. The pixel data in the array must be
998
- stored in scanline order, left-to-right and top-to-bottom.
999
- The elements in the array must be <code>Numeric</code> values
1000
- in the range [0..MaxRGB]. The easiest way to obtain such an
1001
- array is by using the <code>export_pixels</code> method.</dd>
1012
+ <dd>
1013
+ The pixel data. Pixel data can be supplied as an array or
1014
+ as a string.
1015
+
1016
+ <dl>
1017
+ <dt>If <span class="arg">pixels</span> responds to
1018
+ <code>:to_str</code></dt>
1019
+
1020
+ <dd><code>import_pixels</code> assumes that <span class=
1021
+ "arg">pixels</span> can be converted to a string by
1022
+ <code>to_str</code> and that the result is a C array of
1023
+ the type specified by <span class="arg">type</span>
1024
+ containing binary pixel data in the order specified by
1025
+ <span class="arg">map</span>. The elements in the buffer
1026
+ must be in the range specified by <span class=
1027
+ "arg">type</span>.</dd>
1028
+
1029
+ <dt>Otherwise</dt>
1030
+
1031
+ <dd><code>import_pixels</code> assumes that <span class=
1032
+ "arg">pixels</span> is an array or an object that can be
1033
+ converted to an array by the <code>Kernel::Array</code>
1034
+ method. The elements in the array must be
1035
+ <code>Numeric</code> values in the range [0..MaxRGB]. In
1036
+ either case, the pixel data must be stored in scanline
1037
+ order: left-to-right and top-to-bottom.</dd>
1038
+ </dl>
1039
+ </dd>
1040
+
1041
+ <dt>type</dt>
1042
+
1043
+ <dd>
1044
+ Specifies the type and range of the pixel data when
1045
+ <span class="arg">pixels</span> is a string. One of the
1046
+ following constants:
1047
+
1048
+ <dl>
1049
+ <dt>CharPixel</dt>
1050
+
1051
+ <dd>type <code>unsigned char</code>, range 0-255</dd>
1052
+
1053
+ <dt>ShortPixel</dt>
1054
+
1055
+ <dd>type <code>unsigned short</code>, range 0-65535</dd>
1056
+
1057
+ <dt>LongPixel, IntegerPixel</dt>
1058
+
1059
+ <dd>type <code>unsigned long</code>, range
1060
+ 0-4294967295</dd>
1061
+
1062
+ <dt>QuantumPixel</dt>
1063
+
1064
+ <dd>the Quantum type used by &times;Magick (depends on
1065
+ how &times;Magick is configured) range 0-MaxRGB</dd>
1066
+ </dl>The default is <code>Magick::CharPixel</code>. This
1067
+ argument is ignored when <span class="arg">pixels</span> is
1068
+ an array.
1069
+ </dd>
1002
1070
  </dl>
1003
1071
 
1004
1072
  <h4>Returns</h4>
@@ -1010,6 +1078,22 @@ image.get_exif_by_number() &raquo;
1010
1078
  # Replace the r'th scanline of the image using
1011
1079
  # pixel data stored in red-green-blue order.
1012
1080
  img.import_pixels(0, r, img.columns, 1, "RGB", scanline);
1081
+ </pre>
1082
+
1083
+ <h4>Example</h4>
1084
+
1085
+ <p>This example is contrived since there's no need to convert
1086
+ the <code>pixels</code> array into a string by calling
1087
+ <code>pack</code>, but it does demonstrate the use of a string
1088
+ <span class="arg">pixels</span> argument. Note that this
1089
+ example assumes that &times;Magick is configured with
1090
+ QuantumDepth=8.</p>
1091
+ <pre>
1092
+ hat = Magick::Image.read("Flower_Hat.jpg").first
1093
+ pixels = hat.export_pixels(0, 0, hat.columns, hat.rows, "RGB")
1094
+ char_buffer = pixels.pack("C*")
1095
+ img = Magick::Image.new(hat.columns, hat.rows)
1096
+ img.import_pixels(0, 0, hat.columns, hat.rows, "RGB", char_buffer, Magick::CharPixel)
1013
1097
  </pre>
1014
1098
 
1015
1099
  <h4>See also</h4>
@@ -1020,8 +1104,7 @@ img.import_pixels(0, r, img.columns, 1, "RGB", scanline);
1020
1104
 
1021
1105
  <h4>Magick API</h4>
1022
1106
 
1023
- <p>ImportImagePixels (available in ImageMagick 5.5.7 and
1024
- GraphicsMagick 1.1)</p>
1107
+ <p>ImportImagePixels</p>
1025
1108
 
1026
1109
  <h4>Note</h4>
1027
1110
 
@@ -1151,7 +1234,9 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1151
1234
  <img src="ex/images/spin.gif" alt="" class="spin" title=
1152
1235
  "Mouse over the image to see the original image" /></p>
1153
1236
 
1154
- <h4>See also</h4><p><a href="#level_channel">level_channel</a></p>
1237
+ <h4>See also</h4>
1238
+
1239
+ <p><a href="#level_channel">level_channel</a></p>
1155
1240
 
1156
1241
  <h4>Magick API</h4>
1157
1242
 
@@ -1210,11 +1295,13 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1210
1295
  alt="" class="spin" title=
1211
1296
  "Mouse over the example to see the original image" /></p>
1212
1297
 
1213
- <h4>See also</h4><p><a href="#level">level</a></p>
1298
+ <h4>See also</h4>
1299
+
1300
+ <p><a href="#level">level</a></p>
1214
1301
 
1215
1302
  <h4>Magick API</h4>
1216
1303
 
1217
- <p>LevelImageChannel (available in ImageMagick 5.5.3)</p>
1304
+ <p>LevelImageChannel</p>
1218
1305
  </div>
1219
1306
 
1220
1307
  <div class="sig">
@@ -1442,7 +1529,9 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1442
1529
 
1443
1530
  <p>A new image</p>
1444
1531
 
1445
- <h4>See also</h4><p><a href="draw.html#Draw.matte">Draw#matte</a></p>
1532
+ <h4>See also</h4>
1533
+
1534
+ <p><a href="draw.html#Draw.matte">Draw#matte</a></p>
1446
1535
  </div>
1447
1536
 
1448
1537
  <div class="sig">
@@ -1483,8 +1572,9 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1483
1572
  "ex/images/spin.gif" alt="" class="spin" title=
1484
1573
  "Mouse over the image to see the original image" /></p>
1485
1574
 
1486
- <h4>See also</h4><p><a href=
1487
- "image3.html#transparent">transparent</a>, <a href=
1575
+ <h4>See also</h4>
1576
+
1577
+ <p><a href="image3.html#transparent">transparent</a>, <a href=
1488
1578
  "draw.html#matte">Draw#matte</a></p>
1489
1579
 
1490
1580
  <h4>Magick API</h4>
@@ -1496,7 +1586,7 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1496
1586
  <h3 id="matte_reset_bang">matte_reset!</h3>
1497
1587
 
1498
1588
  <p><span class="arg">image</span>.matte_reset! -&gt;
1499
- <em>anImage</em></p>
1589
+ <em>image</em></p>
1500
1590
  </div>
1501
1591
 
1502
1592
  <div class="desc">
@@ -1506,7 +1596,7 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1506
1596
 
1507
1597
  <h4>Returns</h4>
1508
1598
 
1509
- <p>A new image</p>
1599
+ <p>self</p>
1510
1600
 
1511
1601
  <h4>See also</h4>
1512
1602
 
@@ -1549,7 +1639,9 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1549
1639
  "javascript:popup('median_filter.rb.html')"><img src=
1550
1640
  "ex/median_filter.jpg" alt="median_filter example" /></a>
1551
1641
 
1552
- <h4>See also</h4><p><a href="#enhance">enhance</a>, <a href=
1642
+ <h4>See also</h4>
1643
+
1644
+ <p><a href="#enhance">enhance</a>, <a href=
1553
1645
  "image3.html#reduce_noise">reduce_noise</a>, <a href=
1554
1646
  "image3.html#unsharp_mask">unsharp_mask</a></p>
1555
1647
 
@@ -1575,7 +1667,9 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1575
1667
 
1576
1668
  <p>A new image</p>
1577
1669
 
1578
- <h4>See also</h4><p><a href="#minify_bang">minify!</a> <a href=
1670
+ <h4>See also</h4>
1671
+
1672
+ <p><a href="#minify_bang">minify!</a> <a href=
1579
1673
  "#magnify">magnify</a>, <a href=
1580
1674
  "image3.html#resize">resize</a>, <a href=
1581
1675
  "image3.html#sample">sample</a>, <a href=
@@ -1699,7 +1793,7 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1699
1793
  <dt>sigma</dt>
1700
1794
 
1701
1795
  <dd>The standard deviation of the Gaussian operator. Must be
1702
- greater than 0.</dd>
1796
+ non-0.</dd>
1703
1797
 
1704
1798
  <dt>angle</dt>
1705
1799
 
@@ -1762,7 +1856,9 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1762
1856
  "ex/images/spin.gif" alt="" class="spin" title=
1763
1857
  "Mouse over the example to see the original image" /></p>
1764
1858
 
1765
- <h4>See also</h4><p><a href="#negate_channel">negate_channel</a></p>
1859
+ <h4>See also</h4>
1860
+
1861
+ <p><a href="#negate_channel">negate_channel</a></p>
1766
1862
 
1767
1863
  <h4>Magick API</h4>
1768
1864
 
@@ -1817,11 +1913,13 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1817
1913
  "ex/images/spin.gif" alt="" class="spin" title=
1818
1914
  "Mouse over the example to see the original image" /></p>
1819
1915
 
1820
- <h4>See also</h4><p><a href="#negate">negate</a></p>.
1916
+ <h4>See also</h4>
1917
+
1918
+ <p><a href="#negate">negate</a></p>.
1821
1919
 
1822
1920
  <h4>Magick API</h4>
1823
1921
 
1824
- <p>NegateImageChannel (available in ImageMagick 6.0.0)</p>
1922
+ <p>NegateImageChannel</p>
1825
1923
  </div>
1826
1924
 
1827
1925
  <div class="sig">
@@ -1856,22 +1954,31 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1856
1954
  <h4>Magick API</h4>
1857
1955
 
1858
1956
  <p>NormalizeImage</p>
1957
+
1859
1958
  <h4>See also</h4>
1959
+
1860
1960
  <p><a href="#normalize_channel">normalize_channel</a></p>
1861
1961
  </div>
1862
1962
 
1863
1963
  <div class="sig">
1864
1964
  <h3 id="normalize_channel">normalize_channel</h3>
1865
- <p><span class="arg">image</span>.normalize_channel([<span class="arg">channel</span>[,
1866
- <span class="arg">channel</span>...]]) = <em>anImage</em></p>
1965
+
1966
+ <p><span class=
1967
+ "arg">image</span>.normalize_channel([<span class=
1968
+ "arg">channel</span>[, <span class="arg">channel</span>...]]) =
1969
+ <em>anImage</em></p>
1867
1970
  </div>
1868
1971
 
1972
+ <div class="desc">
1973
+ <h4>Description</h4>
1869
1974
 
1870
- <div class="desc">
1871
- <h4>Description</h4>
1872
- <p><span class="imquote">Enhances the contrast of a color image by adjusting the pixel color to span the entire range of colors available.</span> Only the specified channels are normalized.</p>
1975
+ <p><span class="imquote">Enhances the contrast of a color image
1976
+ by adjusting the pixel color to span the entire range of colors
1977
+ available.</span> Only the specified channels are
1978
+ normalized.</p>
1979
+
1980
+ <h4>Arguments</h4>
1873
1981
 
1874
- <h4>Arguments</h4>
1875
1982
  <dl>
1876
1983
  <dt>channel...</dt>
1877
1984
 
@@ -1882,13 +1989,18 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
1882
1989
  <code>normalize</code> method, above.</dd>
1883
1990
  </dl>
1884
1991
 
1885
- <h4>Returns</h4>
1886
- <p>A new image</p>
1887
- <h4>Magick API</h4>
1888
- <p>NormalizeImageChannel (available in ImageMagick 6.1.0)</p>
1992
+ <h4>Returns</h4>
1993
+
1994
+ <p>A new image</p>
1995
+
1996
+ <h4>Magick API</h4>
1997
+
1998
+ <p>NormalizeImageChannel (available in ImageMagick 6.1.0)</p>
1999
+
1889
2000
  <h4>See also</h4>
2001
+
1890
2002
  <p><a href="#normalize">normalize</a></p>
1891
- </div>
2003
+ </div>
1892
2004
 
1893
2005
  <div class="sig">
1894
2006
  <h3 id="oil_paint">oil_paint</h3>
@@ -2032,7 +2144,9 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
2032
2144
  "ex/images/spin.gif" alt="" class="spin" title=
2033
2145
  "Mouse over the example to see the original image" /></p>
2034
2146
 
2035
- <h4>See also</h4><p><a href="#posterize">posterize</a>, <a href=
2147
+ <h4>See also</h4>
2148
+
2149
+ <p><a href="#posterize">posterize</a>, <a href=
2036
2150
  "image3.html#quantize">quantize</a></p>
2037
2151
 
2038
2152
  <h4>Magick API</h4>
@@ -2078,6 +2192,10 @@ f.inspect &raquo; "images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9kb"
2078
2192
  "arg">x</span>, <span class="arg">y</span>. Optionally, changes
2079
2193
  the color of the pixel to a new color.</p>
2080
2194
 
2195
+ <p>If <code>new_color</code> is specified,
2196
+ <code>pixel_color</code> changes the image type to
2197
+ <code>DirectClass</code> if necessary.</p>
2198
+
2081
2199
  <h4>Arguments</h4>
2082
2200
 
2083
2201
  <dl>
@@ -2150,12 +2268,14 @@ old = image.pixel_color(20,40,"white")
2150
2268
  "ex/images/spin.gif" alt="" class="spin" title=
2151
2269
  "Mouse over the example to see the original image" /></p>
2152
2270
 
2153
- <h4>See also</h4><p><a href="#ordered_dither">ordered_dither</a>,
2154
- <a href="image3.html#quantize">quantize</a></p>
2271
+ <h4>See also</h4>
2272
+
2273
+ <p><a href="#ordered_dither">ordered_dither</a>, <a href=
2274
+ "image3.html#quantize">quantize</a></p>
2155
2275
 
2156
2276
  <h4>Magick API</h4>
2157
2277
 
2158
- <p>PosterizeImage (available in ImageMagick 6.0.0)</p>
2278
+ <p>PosterizeImage</p>
2159
2279
  </div>
2160
2280
 
2161
2281
  <p class="spacer">&nbsp;</p>