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.

@@ -305,7 +305,7 @@
305
305
 
306
306
  <h4>Magick API</h4>
307
307
 
308
- <p>PreviewImage (available in ImageMagick 6.0.0)</p>
308
+ <p>PreviewImage</p>
309
309
  </div>
310
310
 
311
311
  <div class="sig">
@@ -352,10 +352,8 @@
352
352
  <p>&times;Magick does not automatically remove profiles when
353
353
  resizing images. If you are trying to make your JPEG thumbnail
354
354
  images as small as possible, use <code>profile!</code> to
355
- remove any profiles from the image as well. See <a href=
356
- "http://www.imagemagick.org/www/FAQ.html#C31"><cite>Why are my
357
- JPEG files larger than expected?</cite></a> in the
358
- &times;Magick FAQ.</p>
355
+ remove any profiles from the image as well. Also see
356
+ <a href="#strip_bang">strip!</a></p>
359
357
  </div>
360
358
 
361
359
  <div class="sig">
@@ -533,7 +531,7 @@
533
531
 
534
532
  <dt>rvalue</dt>
535
533
 
536
- <dd>the operation rvalue. A <code>Float</code>.</dd>
534
+ <dd>a <code>Numeric</code> operation rvalue.</dd>
537
535
 
538
536
  <dt>channel</dt>
539
537
 
@@ -550,11 +548,18 @@
550
548
  <p>Divide the red component of all the pixels in the image by
551
549
  2:</p>
552
550
  <pre>
553
- img.quantum_operator(DivideQuantumOp, 2, RedChannel)
551
+ img.quantum_operator(DivideQuantumOperator, 2, RedChannel)
554
552
  </pre>
555
553
 
554
+ <h4>See also</h4>
555
+
556
+ <p>The <a href="struct.html#view">Image:View</a> class supports
557
+ operations on individual pixels and collections of pixels, as
558
+ well as operations on channels within pixels. See <a href="#view">
559
+ view</a>, below.</p>
560
+
556
561
  <h4>Magick API</h4>QuantumOperatorRegionImage (GraphicsMagick
557
- 1.1), EvaluateImageChannel (ImageMagick 6.0.0)
562
+ 1.1), EvaluateImageChannel (ImageMagick)
558
563
  </div>
559
564
 
560
565
  <div class="sig">
@@ -600,7 +605,7 @@ img.quantum_operator(DivideQuantumOp, 2, RedChannel)
600
605
 
601
606
  <h4>Magick API</h4>
602
607
 
603
- <p>RadialBlurImage (available in ImageMagick 6.0.0.)</p>
608
+ <p>RadialBlurImage</p>
604
609
  </div>
605
610
 
606
611
  <div class="sig">
@@ -719,13 +724,12 @@ random_threshold_channel(geom, RedChannel)
719
724
 
720
725
  <p><a href=
721
726
  "image1.html#adaptive_threshold">adaptive_threshold</a>,
722
- <a href="image1.html#channel_threshold">channel_threshold</a>,
727
+ <a href="image1.html#bilevel_channel">bilevel_channel</a>,
723
728
  <a href="#threshold">threshold</a></p>
724
729
 
725
730
  <h4>Magick API</h4>
726
731
 
727
- <p>RandomThresholdImageChannel (available in ImageMagick
728
- 6.0.0)</p>
732
+ <p>RandomThresholdImageChannel</p>
729
733
  </div>
730
734
 
731
735
  <div class="sig">
@@ -1251,7 +1255,8 @@ random_threshold_channel(geom, RedChannel)
1251
1255
 
1252
1256
  <h4>See also</h4>
1253
1257
 
1254
- <p><a href="image1.html#colorize">colorize</a></p>
1258
+ <p>You can get more control by using
1259
+ <a href="image1.html#colorize">colorize</a>.</p>
1255
1260
 
1256
1261
  <h4>Magick API</h4>
1257
1262
 
@@ -1295,8 +1300,7 @@ random_threshold_channel(geom, RedChannel)
1295
1300
 
1296
1301
  <h4>Magick API</h4>
1297
1302
 
1298
- <p>SetImageChannelDepth (available in ImageMagick 6.0.0,
1299
- GraphicsMagick 1.1)</p>
1303
+ <p>SetImageChannelDepth</p>
1300
1304
  </div>
1301
1305
 
1302
1306
  <div class="sig">
@@ -1653,7 +1657,7 @@ random_threshold_channel(geom, RedChannel)
1653
1657
  "arg">midpoint</span>=50.0, <span class=
1654
1658
  "arg">sharpen</span>=false[,<span class="arg"><span class=
1655
1659
  "arg">channel</span></span>, <span class="arg"><span class=
1656
- "arg">channel</span></span>...] -&gt; anImage</p>
1660
+ "arg">channel</span></span>...]) -&gt; <em>anImage</em></p>
1657
1661
  </div>
1658
1662
 
1659
1663
  <div class="desc">
@@ -1751,6 +1755,47 @@ img.properties &raquo;
1751
1755
  <p>SignatureImage</p>
1752
1756
  </div>
1753
1757
 
1758
+ <div class="sig">
1759
+ <h3 id="solarize">solarize</h3>
1760
+
1761
+ <p><span class="arg">image</span>.solarize(<span class=
1762
+ "arg">threshold</span>=50) -&gt; <em>anImage</em></p>
1763
+ </div>
1764
+
1765
+ <div class="desc">
1766
+ <h4>Description</h4>
1767
+
1768
+ <p class="imquote">Applies a special effect to the image
1769
+ similar to the effect achieved in a photo darkroom by
1770
+ selectively exposing areas of photo sensitive paper to
1771
+ light.</p>
1772
+
1773
+ <h4>Arguments</h4>
1774
+
1775
+ <p><span class="imquote">Ranges from 0 to MaxRGB and is a
1776
+ measure of the extent of the solarization.</span> The default
1777
+ is 50.</p>
1778
+
1779
+ <h4>Returns</h4>
1780
+
1781
+ <p>A new image</p>
1782
+
1783
+ <h4>Example</h4>
1784
+
1785
+ <p class="rollover"><a href=
1786
+ "javascript:popup('solarize.rb.html')"><img src=
1787
+ "ex/solarize.jpg" title="Click to see the example script" alt=
1788
+ "solarize example" onmouseover=
1789
+ "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1790
+ "this.src='ex/solarize.jpg'" /></a> <img src=
1791
+ "ex/images/spin.gif" alt="" class="spin" title=
1792
+ "Mouse over the example to see the original image" /></p>
1793
+
1794
+ <h4>Magick API</h4>
1795
+
1796
+ <p>SolarizeImage</p>
1797
+ </div>
1798
+
1754
1799
  <div class="sig">
1755
1800
  <h3 id="splice">splice</h3>
1756
1801
 
@@ -1818,48 +1863,7 @@ img.properties &raquo;
1818
1863
 
1819
1864
  <h4>Magick API</h4>
1820
1865
 
1821
- <p>SpliceImage (available in ImageMagick 6.0.0)</p>
1822
- </div>
1823
-
1824
- <div class="sig">
1825
- <h3 id="solarize">solarize</h3>
1826
-
1827
- <p><span class="arg">image</span>.solarize(<span class=
1828
- "arg">threshold</span>=50) -&gt; <em>anImage</em></p>
1829
- </div>
1830
-
1831
- <div class="desc">
1832
- <h4>Description</h4>
1833
-
1834
- <p class="imquote">Applies a special effect to the image
1835
- similar to the effect achieved in a photo darkroom by
1836
- selectively exposing areas of photo sensitive paper to
1837
- light.</p>
1838
-
1839
- <h4>Arguments</h4>
1840
-
1841
- <p><span class="imquote">Ranges from 0 to MaxRGB and is a
1842
- measure of the extent of the solarization.</span> The default
1843
- is 50.</p>
1844
-
1845
- <h4>Returns</h4>
1846
-
1847
- <p>A new image</p>
1848
-
1849
- <h4>Example</h4>
1850
-
1851
- <p class="rollover"><a href=
1852
- "javascript:popup('solarize.rb.html')"><img src=
1853
- "ex/solarize.jpg" title="Click to see the example script" alt=
1854
- "solarize example" onmouseover=
1855
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1856
- "this.src='ex/solarize.jpg'" /></a> <img src=
1857
- "ex/images/spin.gif" alt="" class="spin" title=
1858
- "Mouse over the example to see the original image" /></p>
1859
-
1860
- <h4>Magick API</h4>
1861
-
1862
- <p>SolarizeImage</p>
1866
+ <p>SpliceImage</p>
1863
1867
  </div>
1864
1868
 
1865
1869
  <div class="sig">
@@ -2131,7 +2135,7 @@ p stats.red.stddev &raquo; 0.231399683489667
2131
2135
 
2132
2136
  <p>self</p>
2133
2137
 
2134
- <h4>Magick API</h4>StripImage (available in ImageMagick 6.0.0
2138
+ <h4>Magick API</h4>StripImage (available in ImageMagick
2135
2139
  and GraphicsMagick 1.1)
2136
2140
  </div>
2137
2141
 
@@ -2353,9 +2357,9 @@ p stats.red.stddev &raquo; 0.231399683489667
2353
2357
 
2354
2358
  <p><a href=
2355
2359
  "image1.html#adaptive_threshold">adaptive_threshold</a>,
2356
- <a href="image1.html#channel_threshold">channel_threshold</a>,
2360
+ <a href="image1.html#bilevel_channel">bilevel_channel</a>,
2357
2361
  <a href=
2358
- "#random_channel_threshold">random_channel_threshold</a></p>
2362
+ "#random_threshold_channel">random_threshold_channel</a></p>
2359
2363
 
2360
2364
  <h4>Magick API</h4>
2361
2365
 
@@ -2412,8 +2416,7 @@ thumbnail = img.thumbnail(img.columns*0.09, img.rows*0.09)
2412
2416
  "#resize">resize</a>, <a href="#sample">sample</a>, <a href=
2413
2417
  "#scale">scale</a></p>
2414
2418
 
2415
- <h4>Magick API</h4>ThumbnailImage (available in ImageMagick
2416
- 5.5.2)
2419
+ <h4>Magick API</h4><p>ThumbnailImage</p>
2417
2420
  </div>
2418
2421
 
2419
2422
  <div class="sig">
@@ -2974,7 +2977,7 @@ end
2974
2977
 
2975
2978
  <p><a href="image1.html#black_threshold">black_threshold</a>,
2976
2979
  <a href=
2977
- "image1.html#channel_threshold">channel_threshold</a></p>
2980
+ "image1.html#bilevel_channel">bilevel_channel</a></p>
2978
2981
 
2979
2982
  <h4>Magick API</h4>
2980
2983
 
@@ -673,7 +673,7 @@
673
673
 
674
674
  <p>Specify a rectangle within an image, or retrieve the
675
675
  rectangle specified when the image was constituted. See
676
- <a href="info.html#Info.extract_eq">extract=</a>.</p>
676
+ <a href="info.html#extract">extract=</a>.</p>
677
677
 
678
678
  <h4>Arguments</h4>
679
679
 
@@ -851,9 +851,7 @@
851
851
  <h3 id="image_type">image_type</h3>
852
852
 
853
853
  <p><span class="arg">image.</span>image_type -&gt;
854
- <em>anImageType</em><br />
855
- <span class="arg">image.</span>image_type = <span class=
856
- "arg">anImageType</span></p>
854
+ <em>anImageType</em></p>
857
855
  </div>
858
856
 
859
857
  <div class="desc">
@@ -863,15 +861,10 @@
863
861
  Don't confuse this attribute with the <a href=
864
862
  "#format">format</a>, that is "GIF" or "JPG".</p>
865
863
 
866
- <h4>Arguments</h4>
867
-
868
- <p>An <a href="constants.html#ImageType">ImageType</a>
869
- constant.</p>
870
-
871
864
  <h4>Returns</h4>
872
865
 
873
866
  <p>An <a href="constants.html#ImageType">ImageType</a>
874
- constant.</p>
867
+ value.</p>
875
868
  </div>
876
869
 
877
870
  <div class="sig">
@@ -963,8 +956,8 @@
963
956
  <h4>Description</h4>
964
957
 
965
958
  <p><span class="imquote">The mean error per pixel computed when
966
- a image is color reduced.</span> This parameter is only valid
967
- if the verbose argument to <code>quantize</code><a href=
959
+ a image is color reduced.</span> This attribute is only valid
960
+ if the <code>measure_error</code> argument to <code>quantize</code><a href=
968
961
  "ilist.html#quantize">[ImageList]</a><a href=
969
962
  "image3.html#quantize">[Image]</a> is set to <code>true</code>.
970
963
  Get-only.</p>
@@ -1108,8 +1101,8 @@ blur_image is 100% complete.
1108
1101
  <h4>Description</h4>
1109
1102
 
1110
1103
  <p><span class="imquote">The normalized mean error computed
1111
- when an image is color reduced.</span> This parameter is only
1112
- valid if the verbose argument to <code>quantize</code><a href=
1104
+ when an image is color reduced.</span> This attribute is only
1105
+ valid if the <code>measure_error</code> argument to <code>quantize</code><a href=
1113
1106
  "ilist.html#quantize">[ImageList]</a><a href=
1114
1107
  "image3.html#quantize">[Image]</a> is set to <code>true</code>.
1115
1108
  Get-only.</p>
@@ -1127,8 +1120,8 @@ blur_image is 100% complete.
1127
1120
  <h4>Description</h4>
1128
1121
 
1129
1122
  <p><span class="imquote">The normalized mean error per pixel
1130
- computed when an image is color reduced.</span> This parameter
1131
- is only valid if the verbose argument to
1123
+ computed when an image is color reduced.</span> This attribute
1124
+ is only valid if the <code>measure_error</code> argument to
1132
1125
  <code>quantize</code><a href=
1133
1126
  "ilist.html#quantize">[ImageList]</a><a href=
1134
1127
  "image3.html#quantize">[Image]</a> is set to <code>true</code>.
@@ -1404,7 +1397,7 @@ blur_image is 100% complete.
1404
1397
  <p>The number of colors in the image after quantization. Set by
1405
1398
  <code>quantize</code> <a href=
1406
1399
  "ilist.html#quantize">[ImageList]</a><a href=
1407
- "image3.html#quantize">[Image]</a> if the <code>verbose</code>
1400
+ "image3.html#quantize">[Image]</a> if the <code>measure_error</code>
1408
1401
  argument is <code>true</code>. Get-only.</p>
1409
1402
  </div>
1410
1403
 
@@ -861,12 +861,6 @@ exit
861
861
 
862
862
  <dd>Enhance the contrast of the image</dd>
863
863
 
864
- <dt><a href=
865
- "image3.html#random_threshold_channel">random_threshold_channel</a></dt>
866
-
867
- <dd>Change the value of individual pixels based on the
868
- intensity of each pixel compared to a random threshold.</dd>
869
-
870
864
  <dt><a href="image3.html#reduce_noise">reduce_noise</a></dt>
871
865
 
872
866
  <dd>Smooth the contours of an image while still preserving
@@ -919,12 +913,6 @@ exit
919
913
 
920
914
  <dd>Blur the image</dd>
921
915
 
922
- <dt><a href=
923
- "image1.html#channel_threshold">channel_threshold</a></dt>
924
-
925
- <dd>Change the value of individual pixels based on the
926
- intensity of each pixel channel</dd>
927
-
928
916
  <dt><a href="image1.html#colorize">colorize</a></dt>
929
917
 
930
918
  <dd>Blend the fill color with each pixel in the image</dd>
@@ -939,6 +927,12 @@ exit
939
927
  <dd>Segment an image by analyzing the histograms of the color
940
928
  components and identifying units that are homogeneous with
941
929
  the fuzzy c-means technique</dd>
930
+
931
+ <dt><a href="image3.html#random_threshold_channel">
932
+ random_threshold_channel</a></dt>
933
+
934
+ <dd>Change the value of individual pixels based on the
935
+ intensity of each pixel compared to a random threshold.</dd>
942
936
 
943
937
  <dt><a href="image3.html#threshold">threshold</a></dt>
944
938
 
@@ -0,0 +1,187 @@
1
+ require 'RMagick'
2
+
3
+ module Magick
4
+ class Image
5
+
6
+ # Print information similar to the identify -verbose command
7
+ def identify
8
+ printf "Image: "
9
+ puts "#{base_filename}=>" if base_filename != filename
10
+ puts filename + "\n"
11
+ puts "\tFormat: #{format}\n"
12
+ puts "\tGeometry: #{columns}x#{rows}\n"
13
+ puts "\tClass: #{class_type.to_s}\n"
14
+ puts "\tType: #{image_type.to_s}\n"
15
+ puts "\tEndianess: #{endian}\n"
16
+ puts "\tColorspace: #{colorspace}\n"
17
+ puts "\tChannelDepth:\n"
18
+ color_space = gray? ? Magick::GrayColorspace : colorspace
19
+ case color_space
20
+ when Magick::RGBColorspace
21
+ puts "\t\tRed: #{channel_depth(Magick::RedChannel)}-bits\n"
22
+ puts "\t\tGreen: #{channel_depth(Magick::GreenChannel)}-bits\n"
23
+ puts "\t\tBlue: #{channel_depth(Magick::BlueChannel)}-bits\n"
24
+ puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
25
+ when Magick::CMYKColorspace
26
+ puts "\t\tCyan : #{channel_depth(Magick::CyanChannel)}-bits\n"
27
+ puts "\t\tMagenta: #{channel_depth(Magick::MagentaChannel)}-bits\n"
28
+ puts "\t\tYellow: #{channel_depth(Magick::YellowChannel)}-bits\n"
29
+ puts "\t\tBlack: #{channel_depth(Magick::BlackChannel)}-bits\n"
30
+ puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
31
+ when Magick::GrayColorspace
32
+ puts "\t\tGray: #{channel_depth(Magick::GrayChannel)}-bits\n"
33
+ puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
34
+ end
35
+ scale = Magick::MaxRGB / (Magick::MaxRGB >> (Magick::QuantumDepth-channel_depth))
36
+ puts "\tChannel statistics:\n"
37
+ case color_space
38
+ when Magick::RGBColorspace
39
+ puts "\t\tRed:\n"
40
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[0]/scale, channel_extrema(Magick::RedChannel)[0]/Magick::MaxRGB)
41
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[1]/scale, channel_extrema(Magick::RedChannel)[1]/Magick::MaxRGB)
42
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[0]/scale, channel_mean(Magick::RedChannel)[0]/Magick::MaxRGB)
43
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[1]/scale, channel_mean(Magick::RedChannel)[1]/Magick::MaxRGB)
44
+ puts "\t\tGreen:\n"
45
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[0]/scale, channel_extrema(Magick::GreenChannel)[0]/Magick::MaxRGB)
46
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[1]/scale, channel_extrema(Magick::GreenChannel)[1]/Magick::MaxRGB)
47
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[0]/scale, channel_mean(Magick::GreenChannel)[0]/Magick::MaxRGB)
48
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[1]/scale, channel_mean(Magick::GreenChannel)[1]/Magick::MaxRGB)
49
+ puts "\t\tBlue:\n"
50
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[0]/scale, channel_extrema(Magick::BlueChannel)[0]/Magick::MaxRGB)
51
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[1]/scale, channel_extrema(Magick::BlueChannel)[1]/Magick::MaxRGB)
52
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[0]/scale, channel_mean(Magick::BlueChannel)[0]/Magick::MaxRGB)
53
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[1]/scale, channel_mean(Magick::BlueChannel)[1]/Magick::MaxRGB)
54
+ when Magick::CMYKColorspace
55
+ puts "\t\tCyan:\n"
56
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[0]/scale, channel_extrema(Magick::CyanChannel)[0]/Magick::MaxRGB)
57
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[1]/scale, channel_extrema(Magick::CyanChannel)[1]/Magick::MaxRGB)
58
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[0]/scale, channel_mean(Magick::CyanChannel)[0]/Magick::MaxRGB)
59
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[1]/scale, channel_mean(Magick::CyanChannel)[1]/Magick::MaxRGB)
60
+ puts "\t\tMagenta:\n"
61
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[0]/scale, channel_extrema(Magick::MagentaChannel)[0]/Magick::MaxRGB)
62
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[1]/scale, channel_extrema(Magick::MagentaChannel)[1]/Magick::MaxRGB)
63
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[0]/scale, channel_mean(Magick::MagentaChannel)[0]/Magick::MaxRGB)
64
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[1]/scale, channel_mean(Magick::MagentaChannel)[1]/Magick::MaxRGB)
65
+ puts "\t\tYellow:\n"
66
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[0]/scale, channel_extrema(Magick::YellowChannel)[0]/Magick::MaxRGB)
67
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[1]/scale, channel_extrema(Magick::YellowChannel)[1]/Magick::MaxRGB)
68
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[0]/scale, channel_mean(Magick::YellowChannel)[0]/Magick::MaxRGB)
69
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[1]/scale, channel_mean(Magick::YellowChannel)[1]/Magick::MaxRGB)
70
+ puts "\t\tBlack:\n"
71
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[0]/scale, channel_extrema(Magick::BlackChannel)[0]/Magick::MaxRGB)
72
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[1]/scale, channel_extrema(Magick::BlackChannel)[1]/Magick::MaxRGB)
73
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[0]/scale, channel_mean(Magick::BlackChannel)[0]/Magick::MaxRGB)
74
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[1]/scale, channel_mean(Magick::BlackChannel)[1]/Magick::MaxRGB)
75
+ when Magick::GrayColorspace
76
+ puts "\t\tGray:\n"
77
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[0]/scale, channel_extrema(Magick::GrayChannel)[0]/Magick::MaxRGB)
78
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[1]/scale, channel_extrema(Magick::GrayChannel)[1]/Magick::MaxRGB)
79
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[0]/scale, channel_mean(Magick::GrayChannel)[0]/Magick::MaxRGB)
80
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[1]/scale, channel_mean(Magick::GrayChannel)[1]/Magick::MaxRGB)
81
+ end
82
+ if matte
83
+ puts "\t\tOpacity:\n"
84
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[0]/scale, channel_extrema(Magick::OpacityChannel)[0]/Magick::MaxRGB)
85
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[1]/scale, channel_extrema(Magick::OpacityChannel)[1]/Magick::MaxRGB)
86
+ puts "\t\t\tMean:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[0]/scale, channel_mean(Magick::OpacityChannel)[0]/Magick::MaxRGB)
87
+ puts "\t\t\tStandard deviation:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[1]/scale, channel_mean(Magick::OpacityChannel)[1]/Magick::MaxRGB)
88
+ end
89
+ if class_type == Magick::DirectClass
90
+ puts "\tColors: #{total_colors}\n"
91
+ else
92
+ if total_colors <= colors
93
+ puts "\tColors: #{colors}\n"
94
+ else
95
+ puts "\tColors: #{total_colors}=>#{colors}\n"
96
+ end
97
+ end
98
+ # Histogram goes here
99
+ puts "\tMean error per pixel: #{mean_error_per_pixel}\n" if mean_error_per_pixel != 0.0
100
+ puts "\tNormalized mean error: #{normalized_mean_error}\n" if normalized_mean_error != 0.0
101
+ puts "\tNormalized maximum error: #{normalized_maximum_error}\n" if normalized_maximum_error != 0.0
102
+ puts "\tRendering-intent: #{rendering_intent.to_s}\n"
103
+ puts "\tGamma: #{gamma}\n" if gamma != 0.0
104
+ chrom = chromaticity
105
+ if chrom.red_primary.x != 0.0 || chrom.green_primary.x != 0.0 || chrom.blue_primary.x != 0.0 || chrom.white_point.x != 0.0
106
+ puts "\tChromaticity:\n"
107
+ puts "\t\tred primary: (#{sprintf("%g,%g", chrom.red_primary.x, chrom.red_primary.y)})\n"
108
+ puts "\t\tgreen primary: (#{sprintf("%g,%g", chrom.green_primary.x, chrom.green_primary.y)})\n"
109
+ puts "\t\tblue primary: (#{sprintf("%g,%g", chrom.blue_primary.x, chrom.blue_primary.y)})\n"
110
+ puts "\t\twhite point: (#{sprintf("%g,%g", chrom.white_point.x, chrom.white_point.y)})\n"
111
+ end
112
+ ex_info = extract_info
113
+ if ex_info.width * ex_info.height != 0.0
114
+ puts "\tTile geometry: #{ex_info.width}x#{ex_info.height}+#{ex_info.x}+#{ex_info.y}\n"
115
+ end
116
+ if x_resolution != 0.0 && y_resolution != 0.0
117
+ puts "\tResolution: #{sprintf("%gx%g", x_resolution, y_resolution)}\n"
118
+ end
119
+ puts "\tUnits: #{units.to_s}\n"
120
+ size = filesize
121
+ if size >= 1048576
122
+ puts "\tFilesize: #{"%.1f" % (size/1048576.0)}mb\n"
123
+ elsif size >= 1024
124
+ puts "\tFilesize: #{"%.0f" % (size/1024.0)}kb\n"
125
+ else
126
+ puts "\tFilesize: #{size}b\n"
127
+ end
128
+ puts "\tInterlace: #{interlace.to_s}\n"
129
+ puts "\tBackground Color: #{background_color}\n"
130
+ puts "\tBorder Color: #{border_color}\n"
131
+ puts "\tMatte Color: #{matte_color}\n"
132
+ pg = page
133
+ if pg.width != 0 || pg.height != 0 || pg.x != 0 || pg.y != 0
134
+ puts "\tPage geometry: #{pg.width}x#{pg.height}+#{pg.x}+#{pg.y}\n"
135
+ end
136
+ puts "\tDispose: #{dispose.to_s}\n"
137
+ puts "\tDelay: #{delay}\n" if delay != 0
138
+ puts "\tIterations: #{iterations}\n" unless iterations == 1
139
+ puts "\tScene: #{scene}\n" if scene != 0
140
+ puts "\tCompression: #{compression.to_s}\n"
141
+ puts "\tQuality: #{quality}\n" unless quality == 0
142
+ puts "\tOrientation: #{orientation.to_s}\n"
143
+ puts "\tMontage: #{montage}\n" if montage
144
+ signature # compute but ignore - will be displayed along with the other properties
145
+ properties.each do |prop, value|
146
+ next if prop[0,1] == '['
147
+ puts "\t#{prop}: #{value}\n"
148
+ end
149
+ clip_path = self["8BIM:1999,2998:#1"]
150
+ if clip_path
151
+ puts "\tClipping path: #{clip_path}\n"
152
+ end
153
+ each_profile do |name, value|
154
+ puts "\tProfile-#{name}: #{value.length}\n"
155
+ if name == 'exif'
156
+ exif_attrs = get_exif_by_entry
157
+ exif_attrs.each do |attr|
158
+ puts "\t\t#{attr[0]}: #{attr[1]}\n"
159
+ end
160
+ end
161
+ end
162
+ puts "\tTainted: True\n" if changed?
163
+ puts "\tTainted: False\n" unless changed?
164
+ puts "\tVersion: #{Magick::Version}\n"
165
+ puts "\t #{Magick::Magick_version}\n"
166
+ end
167
+ end
168
+ end
169
+
170
+ if ARGV.length == 0
171
+ puts <<-'END_USAGE'
172
+ This example displays information about the specified image file(s)
173
+ that is similar to ImageMagick/GraphicsMagick's identify command.
174
+
175
+ Usage:
176
+ ruby identify.rb filename [filename...]
177
+ END_USAGE
178
+ exit
179
+ end
180
+
181
+ ilist = Magick::ImageList.new(*ARGV)
182
+ ilist.each do |img|
183
+ img.identify
184
+ end
185
+
186
+ exit
187
+