rdp-rmagick 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (388) hide show
  1. data/ChangeLog +769 -0
  2. data/Doxyfile +1514 -0
  3. data/README-Mac-OSX.txt +1 -0
  4. data/README.md +231 -0
  5. data/build_tarball.rake +215 -0
  6. data/doc/comtasks.html +287 -0
  7. data/doc/constants.html +1581 -0
  8. data/doc/css/doc.css +299 -0
  9. data/doc/css/popup.css +34 -0
  10. data/doc/css/ref.css +67 -0
  11. data/doc/draw.html +3269 -0
  12. data/doc/ex/InitialCoords.rb +23 -0
  13. data/doc/ex/NewCoordSys.rb +32 -0
  14. data/doc/ex/OrigCoordSys.rb +18 -0
  15. data/doc/ex/PreserveAspectRatio.rb +205 -0
  16. data/doc/ex/RotateScale.rb +37 -0
  17. data/doc/ex/Skew.rb +38 -0
  18. data/doc/ex/Use01.rb +16 -0
  19. data/doc/ex/Use02.rb +21 -0
  20. data/doc/ex/Use03.rb +16 -0
  21. data/doc/ex/ViewBox.rb +33 -0
  22. data/doc/ex/adaptive_threshold.rb +10 -0
  23. data/doc/ex/add_noise.rb +17 -0
  24. data/doc/ex/affine.rb +48 -0
  25. data/doc/ex/affine_transform.rb +20 -0
  26. data/doc/ex/arc.rb +49 -0
  27. data/doc/ex/arcpath.rb +33 -0
  28. data/doc/ex/arcs01.rb +28 -0
  29. data/doc/ex/arcs02.rb +61 -0
  30. data/doc/ex/average.rb +15 -0
  31. data/doc/ex/axes.rb +64 -0
  32. data/doc/ex/baseline_shift01.rb +18 -0
  33. data/doc/ex/bilevel_channel.rb +9 -0
  34. data/doc/ex/blur_image.rb +12 -0
  35. data/doc/ex/border.rb +10 -0
  36. data/doc/ex/bounding_box.rb +44 -0
  37. data/doc/ex/cbezier1.rb +42 -0
  38. data/doc/ex/cbezier2.rb +42 -0
  39. data/doc/ex/cbezier3.rb +42 -0
  40. data/doc/ex/cbezier4.rb +43 -0
  41. data/doc/ex/cbezier5.rb +43 -0
  42. data/doc/ex/cbezier6.rb +53 -0
  43. data/doc/ex/channel.rb +26 -0
  44. data/doc/ex/charcoal.rb +12 -0
  45. data/doc/ex/chop.rb +29 -0
  46. data/doc/ex/circle.rb +33 -0
  47. data/doc/ex/circle01.rb +17 -0
  48. data/doc/ex/clip_path.rb +60 -0
  49. data/doc/ex/coalesce.rb +60 -0
  50. data/doc/ex/color_fill_to_border.rb +29 -0
  51. data/doc/ex/color_floodfill.rb +28 -0
  52. data/doc/ex/color_histogram.rb +48 -0
  53. data/doc/ex/color_reset.rb +11 -0
  54. data/doc/ex/colorize.rb +16 -0
  55. data/doc/ex/colors.rb +64 -0
  56. data/doc/ex/compose_mask.rb +23 -0
  57. data/doc/ex/composite.rb +135 -0
  58. data/doc/ex/composite_layers.rb +53 -0
  59. data/doc/ex/composite_tiled.rb +23 -0
  60. data/doc/ex/contrast.rb +36 -0
  61. data/doc/ex/crop.rb +31 -0
  62. data/doc/ex/crop_with_gravity.rb +46 -0
  63. data/doc/ex/cubic01.rb +45 -0
  64. data/doc/ex/cubic02.rb +94 -0
  65. data/doc/ex/cycle_colormap.rb +21 -0
  66. data/doc/ex/dissolve.rb +13 -0
  67. data/doc/ex/drawcomp.rb +42 -0
  68. data/doc/ex/drop_shadow.rb +60 -0
  69. data/doc/ex/edge.rb +11 -0
  70. data/doc/ex/ellipse.rb +45 -0
  71. data/doc/ex/ellipse01.rb +22 -0
  72. data/doc/ex/emboss.rb +11 -0
  73. data/doc/ex/enhance.rb +28 -0
  74. data/doc/ex/equalize.rb +11 -0
  75. data/doc/ex/evenodd.rb +43 -0
  76. data/doc/ex/fill_pattern.rb +26 -0
  77. data/doc/ex/flatten_images.rb +36 -0
  78. data/doc/ex/flip.rb +11 -0
  79. data/doc/ex/flop.rb +11 -0
  80. data/doc/ex/font_styles.rb +34 -0
  81. data/doc/ex/fonts.rb +20 -0
  82. data/doc/ex/frame.rb +12 -0
  83. data/doc/ex/gaussian_blur.rb +11 -0
  84. data/doc/ex/get_multiline_type_metrics.rb +42 -0
  85. data/doc/ex/get_pixels.rb +48 -0
  86. data/doc/ex/get_type_metrics.rb +146 -0
  87. data/doc/ex/gradientfill.rb +27 -0
  88. data/doc/ex/grav.rb +46 -0
  89. data/doc/ex/gravity.rb +79 -0
  90. data/doc/ex/group.rb +26 -0
  91. data/doc/ex/hatchfill.rb +27 -0
  92. data/doc/ex/image.rb +46 -0
  93. data/doc/ex/images/Apple.miff +0 -0
  94. data/doc/ex/images/Ballerina.jpg +0 -0
  95. data/doc/ex/images/Ballerina3.jpg +0 -0
  96. data/doc/ex/images/Button_0.gif +0 -0
  97. data/doc/ex/images/Button_1.gif +0 -0
  98. data/doc/ex/images/Button_2.gif +0 -0
  99. data/doc/ex/images/Button_3.gif +0 -0
  100. data/doc/ex/images/Button_4.gif +0 -0
  101. data/doc/ex/images/Button_5.gif +0 -0
  102. data/doc/ex/images/Button_6.gif +0 -0
  103. data/doc/ex/images/Button_7.gif +0 -0
  104. data/doc/ex/images/Button_8.gif +0 -0
  105. data/doc/ex/images/Button_9.gif +0 -0
  106. data/doc/ex/images/Button_A.gif +0 -0
  107. data/doc/ex/images/Button_B.gif +0 -0
  108. data/doc/ex/images/Button_C.gif +0 -0
  109. data/doc/ex/images/Button_D.gif +0 -0
  110. data/doc/ex/images/Button_E.gif +0 -0
  111. data/doc/ex/images/Button_F.gif +0 -0
  112. data/doc/ex/images/Button_G.gif +0 -0
  113. data/doc/ex/images/Button_H.gif +0 -0
  114. data/doc/ex/images/Button_I.gif +0 -0
  115. data/doc/ex/images/Button_J.gif +0 -0
  116. data/doc/ex/images/Button_K.gif +0 -0
  117. data/doc/ex/images/Button_L.gif +0 -0
  118. data/doc/ex/images/Button_M.gif +0 -0
  119. data/doc/ex/images/Button_N.gif +0 -0
  120. data/doc/ex/images/Button_O.gif +0 -0
  121. data/doc/ex/images/Button_P.gif +0 -0
  122. data/doc/ex/images/Button_Q.gif +0 -0
  123. data/doc/ex/images/Button_R.gif +0 -0
  124. data/doc/ex/images/Button_S.gif +0 -0
  125. data/doc/ex/images/Button_T.gif +0 -0
  126. data/doc/ex/images/Button_U.gif +0 -0
  127. data/doc/ex/images/Button_V.gif +0 -0
  128. data/doc/ex/images/Button_W.gif +0 -0
  129. data/doc/ex/images/Button_X.gif +0 -0
  130. data/doc/ex/images/Button_Y.gif +0 -0
  131. data/doc/ex/images/Button_Z.gif +0 -0
  132. data/doc/ex/images/Cheetah.jpg +0 -0
  133. data/doc/ex/images/Coffee.wmf +0 -0
  134. data/doc/ex/images/Flower_Hat.jpg +0 -0
  135. data/doc/ex/images/Gold_Statue.jpg +0 -0
  136. data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
  137. data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
  138. data/doc/ex/images/Leaf.miff +0 -0
  139. data/doc/ex/images/No.wmf +0 -0
  140. data/doc/ex/images/Polynesia.jpg +0 -0
  141. data/doc/ex/images/Red_Rocks.jpg +0 -0
  142. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  143. data/doc/ex/images/Shorts.jpg +0 -0
  144. data/doc/ex/images/Snake.wmf +0 -0
  145. data/doc/ex/images/Violin.jpg +0 -0
  146. data/doc/ex/images/Yellow_Rose.miff +0 -0
  147. data/doc/ex/images/big-duck.gif +0 -0
  148. data/doc/ex/images/duck.gif +0 -0
  149. data/doc/ex/images/duck0.gif +0 -0
  150. data/doc/ex/images/duck1.gif +0 -0
  151. data/doc/ex/images/duck10.gif +0 -0
  152. data/doc/ex/images/duck11.gif +0 -0
  153. data/doc/ex/images/duck12.gif +0 -0
  154. data/doc/ex/images/duck13.gif +0 -0
  155. data/doc/ex/images/duck14.gif +0 -0
  156. data/doc/ex/images/duck15.gif +0 -0
  157. data/doc/ex/images/duck2.gif +0 -0
  158. data/doc/ex/images/duck3.gif +0 -0
  159. data/doc/ex/images/duck4.gif +0 -0
  160. data/doc/ex/images/duck5.gif +0 -0
  161. data/doc/ex/images/duck6.gif +0 -0
  162. data/doc/ex/images/duck7.gif +0 -0
  163. data/doc/ex/images/duck8.gif +0 -0
  164. data/doc/ex/images/duck9.gif +0 -0
  165. data/doc/ex/images/graydient230x6.gif +0 -0
  166. data/doc/ex/images/logo400x83.gif +0 -0
  167. data/doc/ex/images/model.miff +0 -0
  168. data/doc/ex/images/notimplemented.gif +0 -0
  169. data/doc/ex/images/smile.miff +0 -0
  170. data/doc/ex/images/spin.gif +0 -0
  171. data/doc/ex/implode.rb +34 -0
  172. data/doc/ex/level.rb +11 -0
  173. data/doc/ex/level_colors.rb +11 -0
  174. data/doc/ex/line.rb +42 -0
  175. data/doc/ex/line01.rb +23 -0
  176. data/doc/ex/mask.rb +36 -0
  177. data/doc/ex/matte_fill_to_border.rb +40 -0
  178. data/doc/ex/matte_floodfill.rb +33 -0
  179. data/doc/ex/matte_replace.rb +40 -0
  180. data/doc/ex/median_filter.rb +28 -0
  181. data/doc/ex/modulate.rb +11 -0
  182. data/doc/ex/mono.rb +23 -0
  183. data/doc/ex/morph.rb +26 -0
  184. data/doc/ex/mosaic.rb +35 -0
  185. data/doc/ex/motion_blur.rb +11 -0
  186. data/doc/ex/negate.rb +11 -0
  187. data/doc/ex/negate_channel.rb +9 -0
  188. data/doc/ex/nested_rvg.rb +21 -0
  189. data/doc/ex/nonzero.rb +43 -0
  190. data/doc/ex/normalize.rb +11 -0
  191. data/doc/ex/oil_paint.rb +11 -0
  192. data/doc/ex/opacity.rb +37 -0
  193. data/doc/ex/ordered_dither.rb +11 -0
  194. data/doc/ex/path.rb +64 -0
  195. data/doc/ex/pattern1.rb +25 -0
  196. data/doc/ex/pattern2.rb +26 -0
  197. data/doc/ex/polaroid.rb +28 -0
  198. data/doc/ex/polygon.rb +24 -0
  199. data/doc/ex/polygon01.rb +23 -0
  200. data/doc/ex/polyline.rb +23 -0
  201. data/doc/ex/polyline01.rb +23 -0
  202. data/doc/ex/posterize.rb +8 -0
  203. data/doc/ex/preview.rb +9 -0
  204. data/doc/ex/qbezierpath.rb +52 -0
  205. data/doc/ex/quad01.rb +36 -0
  206. data/doc/ex/quantize-m.rb +25 -0
  207. data/doc/ex/radial_blur.rb +9 -0
  208. data/doc/ex/raise.rb +8 -0
  209. data/doc/ex/random_threshold_channel.rb +13 -0
  210. data/doc/ex/rect01.rb +15 -0
  211. data/doc/ex/rect02.rb +22 -0
  212. data/doc/ex/rectangle.rb +35 -0
  213. data/doc/ex/reduce_noise.rb +28 -0
  214. data/doc/ex/remap.rb +12 -0
  215. data/doc/ex/remap_images.rb +21 -0
  216. data/doc/ex/resize_to_fill.rb +10 -0
  217. data/doc/ex/resize_to_fit.rb +10 -0
  218. data/doc/ex/roll.rb +9 -0
  219. data/doc/ex/rotate.rb +45 -0
  220. data/doc/ex/rotate_f.rb +14 -0
  221. data/doc/ex/roundrect.rb +34 -0
  222. data/doc/ex/rubyname.rb +30 -0
  223. data/doc/ex/rvg_clippath.rb +14 -0
  224. data/doc/ex/rvg_linecap.rb +43 -0
  225. data/doc/ex/rvg_linejoin.rb +41 -0
  226. data/doc/ex/rvg_opacity.rb +19 -0
  227. data/doc/ex/rvg_pattern.rb +26 -0
  228. data/doc/ex/rvg_stroke_dasharray.rb +12 -0
  229. data/doc/ex/segment.rb +11 -0
  230. data/doc/ex/sepiatone.rb +8 -0
  231. data/doc/ex/shade.rb +11 -0
  232. data/doc/ex/shadow.rb +31 -0
  233. data/doc/ex/shave.rb +15 -0
  234. data/doc/ex/shear.rb +10 -0
  235. data/doc/ex/sketch.rb +18 -0
  236. data/doc/ex/skewx.rb +52 -0
  237. data/doc/ex/skewy.rb +47 -0
  238. data/doc/ex/smile.rb +125 -0
  239. data/doc/ex/solarize.rb +11 -0
  240. data/doc/ex/sparse_color.rb +55 -0
  241. data/doc/ex/splice.rb +9 -0
  242. data/doc/ex/spread.rb +11 -0
  243. data/doc/ex/stegano.rb +55 -0
  244. data/doc/ex/stroke_dasharray.rb +43 -0
  245. data/doc/ex/stroke_fill.rb +11 -0
  246. data/doc/ex/stroke_linecap.rb +44 -0
  247. data/doc/ex/stroke_linejoin.rb +48 -0
  248. data/doc/ex/stroke_width.rb +49 -0
  249. data/doc/ex/swirl.rb +17 -0
  250. data/doc/ex/text.rb +37 -0
  251. data/doc/ex/text01.rb +17 -0
  252. data/doc/ex/text_align.rb +36 -0
  253. data/doc/ex/text_antialias.rb +38 -0
  254. data/doc/ex/text_styles.rb +21 -0
  255. data/doc/ex/text_undercolor.rb +28 -0
  256. data/doc/ex/texture_fill_to_border.rb +34 -0
  257. data/doc/ex/texture_floodfill.rb +32 -0
  258. data/doc/ex/texturefill.rb +25 -0
  259. data/doc/ex/threshold.rb +13 -0
  260. data/doc/ex/to_blob.rb +14 -0
  261. data/doc/ex/translate.rb +39 -0
  262. data/doc/ex/transparent.rb +38 -0
  263. data/doc/ex/transpose.rb +9 -0
  264. data/doc/ex/transverse.rb +9 -0
  265. data/doc/ex/tref01.rb +25 -0
  266. data/doc/ex/triangle01.rb +16 -0
  267. data/doc/ex/trim.rb +24 -0
  268. data/doc/ex/tspan01.rb +18 -0
  269. data/doc/ex/tspan02.rb +19 -0
  270. data/doc/ex/tspan03.rb +21 -0
  271. data/doc/ex/unsharp_mask.rb +28 -0
  272. data/doc/ex/viewex.rb +35 -0
  273. data/doc/ex/vignette.rb +12 -0
  274. data/doc/ex/watermark.rb +28 -0
  275. data/doc/ex/wave.rb +9 -0
  276. data/doc/ex/wet_floor.rb +59 -0
  277. data/doc/ex/writing_mode01.rb +27 -0
  278. data/doc/ex/writing_mode02.rb +26 -0
  279. data/doc/ilist.html +2056 -0
  280. data/doc/image1.html +4680 -0
  281. data/doc/image2.html +3665 -0
  282. data/doc/image3.html +4522 -0
  283. data/doc/imageattrs.html +1638 -0
  284. data/doc/imusage.html +514 -0
  285. data/doc/index.html +416 -0
  286. data/doc/info.html +1499 -0
  287. data/doc/magick.html +565 -0
  288. data/doc/optequiv.html +2435 -0
  289. data/doc/rvg.html +975 -0
  290. data/doc/rvgclip.html +248 -0
  291. data/doc/rvggroup.html +305 -0
  292. data/doc/rvgimage.html +289 -0
  293. data/doc/rvgpattern.html +475 -0
  294. data/doc/rvgshape.html +406 -0
  295. data/doc/rvgstyle.html +270 -0
  296. data/doc/rvgtext.html +465 -0
  297. data/doc/rvgtspan.html +238 -0
  298. data/doc/rvgtut.html +530 -0
  299. data/doc/rvguse.html +145 -0
  300. data/doc/rvgxform.html +294 -0
  301. data/doc/scripts/doc.js +22 -0
  302. data/doc/scripts/stripeTables.js +23 -0
  303. data/doc/struct.html +1339 -0
  304. data/doc/usage.html +1621 -0
  305. data/examples/constitute.rb +7 -0
  306. data/examples/crop_with_gravity.rb +46 -0
  307. data/examples/demo.rb +324 -0
  308. data/examples/describe.rb +44 -0
  309. data/examples/find_similar_region.rb +34 -0
  310. data/examples/histogram.rb +325 -0
  311. data/examples/identify.rb +187 -0
  312. data/examples/image_opacity.rb +29 -0
  313. data/examples/import_export.rb +31 -0
  314. data/examples/pattern_fill.rb +38 -0
  315. data/examples/rotating_text.rb +45 -0
  316. data/examples/spinner.rb +50 -0
  317. data/examples/thumbnail.rb +65 -0
  318. data/examples/vignette.rb +79 -0
  319. data/ext/RMagick/Makefile +180 -0
  320. data/ext/RMagick/RMagick2.so +0 -0
  321. data/ext/RMagick/extconf.h +119 -0
  322. data/ext/RMagick/extconf.rb +406 -0
  323. data/ext/RMagick/mkmf.log +3022 -0
  324. data/ext/RMagick/rmagick.c +394 -0
  325. data/ext/RMagick/rmagick.h +1307 -0
  326. data/ext/RMagick/rmagick.o +0 -0
  327. data/ext/RMagick/rmdraw.c +1991 -0
  328. data/ext/RMagick/rmdraw.o +0 -0
  329. data/ext/RMagick/rmenum.c +1224 -0
  330. data/ext/RMagick/rmenum.o +0 -0
  331. data/ext/RMagick/rmfill.c +717 -0
  332. data/ext/RMagick/rmfill.o +0 -0
  333. data/ext/RMagick/rmilist.c +1217 -0
  334. data/ext/RMagick/rmilist.o +0 -0
  335. data/ext/RMagick/rmimage.c +15099 -0
  336. data/ext/RMagick/rmimage.o +0 -0
  337. data/ext/RMagick/rminfo.c +2567 -0
  338. data/ext/RMagick/rminfo.o +0 -0
  339. data/ext/RMagick/rmmain.c +1705 -0
  340. data/ext/RMagick/rmmain.o +0 -0
  341. data/ext/RMagick/rmmontage.c +511 -0
  342. data/ext/RMagick/rmmontage.o +0 -0
  343. data/ext/RMagick/rmpixel.c +1103 -0
  344. data/ext/RMagick/rmpixel.o +0 -0
  345. data/ext/RMagick/rmstruct.c +1047 -0
  346. data/ext/RMagick/rmstruct.o +0 -0
  347. data/ext/RMagick/rmutil.c +1730 -0
  348. data/ext/RMagick/rmutil.o +0 -0
  349. data/lib/RMagick.rb +1962 -0
  350. data/lib/rvg/clippath.rb +48 -0
  351. data/lib/rvg/container.rb +131 -0
  352. data/lib/rvg/deep_equal.rb +56 -0
  353. data/lib/rvg/describable.rb +53 -0
  354. data/lib/rvg/embellishable.rb +417 -0
  355. data/lib/rvg/misc.rb +740 -0
  356. data/lib/rvg/paint.rb +55 -0
  357. data/lib/rvg/pathdata.rb +131 -0
  358. data/lib/rvg/rvg.rb +283 -0
  359. data/lib/rvg/stretchable.rb +168 -0
  360. data/lib/rvg/stylable.rb +124 -0
  361. data/lib/rvg/text.rb +187 -0
  362. data/lib/rvg/to_c.rb +103 -0
  363. data/lib/rvg/transformable.rb +133 -0
  364. data/lib/rvg/units.rb +66 -0
  365. data/metaconfig +7 -0
  366. data/post-clean.rb +12 -0
  367. data/post-install.rb +50 -0
  368. data/post-setup.rb +254 -0
  369. data/rmagick.gemspec +20 -0
  370. data/setup.rb +1585 -0
  371. data/test/Draw.rb +121 -0
  372. data/test/Image1.rb +762 -0
  373. data/test/Image2.rb +1308 -0
  374. data/test/Image3.rb +1001 -0
  375. data/test/ImageList1.rb +808 -0
  376. data/test/ImageList2.rb +389 -0
  377. data/test/Image_attributes.rb +682 -0
  378. data/test/Import_Export.rb +116 -0
  379. data/test/Info.rb +349 -0
  380. data/test/Magick.rb +364 -0
  381. data/test/Pixel.rb +120 -0
  382. data/test/Preview.rb +62 -0
  383. data/test/all_basic.rb +39 -0
  384. data/test/cmyk.icm +0 -0
  385. data/test/srgb.icm +0 -0
  386. data/test/test.0 +0 -0
  387. data/uninstall.rb +74 -0
  388. metadata +455 -0
@@ -0,0 +1,325 @@
1
+ # This routine needs the color_histogram method
2
+ # from either ImageMagick 6.0.0 or GraphicsMagick 1.1
3
+ # Specify an image filename as an argument.
4
+
5
+ require 'RMagick'
6
+
7
+ class PixelColumn < Array
8
+ def initialize(size)
9
+ super
10
+ fill {Magick::Pixel.new}
11
+ end
12
+
13
+ def reset(bg)
14
+ each {|pixel| pixel.reset(bg)}
15
+ end
16
+ end
17
+
18
+ module Magick
19
+
20
+ class Pixel
21
+ def reset(bg)
22
+ self.red = bg.red
23
+ self.green = bg.green
24
+ self.blue = bg.blue
25
+ self.opacity = bg.opacity
26
+ end
27
+ end
28
+
29
+ class Image
30
+
31
+ private
32
+ HISTOGRAM_COLS = 256
33
+ HISTOGRAM_ROWS = 200
34
+ MAX_QUANTUM = 255
35
+ AIR_FACTOR = 1.025
36
+
37
+ # The alpha frequencies are shown as white dots.
38
+ def alpha_hist(freqs, scale, fg, bg)
39
+ histogram = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) {
40
+ self.background_color = bg
41
+ self.border_color = fg
42
+ }
43
+
44
+ gc = Draw.new
45
+ gc.affine(1, 0, 0, -scale, 0, HISTOGRAM_ROWS)
46
+ gc.fill('white')
47
+
48
+ HISTOGRAM_COLS.times do |x|
49
+ gc.point(x, freqs[x])
50
+ end
51
+
52
+ gc.draw(histogram)
53
+ histogram['Label'] = 'Alpha'
54
+
55
+ return histogram
56
+ end
57
+
58
+ def channel_histograms(red, green, blue, int, scale, fg, bg)
59
+ rgb_histogram = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) {
60
+ self.background_color = bg
61
+ self.border_color = fg
62
+ }
63
+ rgb_histogram['Label'] = 'RGB'
64
+ red_histogram = rgb_histogram.copy
65
+ red_histogram['Label'] = 'Red'
66
+ green_histogram = rgb_histogram.copy
67
+ green_histogram['Label'] = 'Green'
68
+ blue_histogram = rgb_histogram.copy
69
+ blue_histogram['Label'] = 'Blue'
70
+ int_histogram = rgb_histogram.copy
71
+ int_histogram['Label'] = 'Intensity'
72
+ int_histogram.matte = true
73
+
74
+ rgb_column = PixelColumn.new(HISTOGRAM_ROWS)
75
+ red_column = PixelColumn.new(HISTOGRAM_ROWS)
76
+ green_column = PixelColumn.new(HISTOGRAM_ROWS)
77
+ blue_column = PixelColumn.new(HISTOGRAM_ROWS)
78
+ int_column = PixelColumn.new(HISTOGRAM_ROWS)
79
+
80
+ HISTOGRAM_COLS.times do |x|
81
+ HISTOGRAM_ROWS.times do |y|
82
+
83
+ yf = Float(y)
84
+ if yf >= HISTOGRAM_ROWS - (red[x] * scale)
85
+ red_column[y].red = QuantumRange
86
+ red_column[y].green = 0
87
+ red_column[y].blue = 0
88
+ rgb_column[y].red = QuantumRange
89
+ end
90
+ if yf >= HISTOGRAM_ROWS - (green[x] * scale)
91
+ green_column[y].green = QuantumRange
92
+ green_column[y].red = 0
93
+ green_column[y].blue = 0
94
+ rgb_column[y].green = QuantumRange
95
+ end
96
+ if yf >= HISTOGRAM_ROWS - (blue[x] * scale)
97
+ blue_column[y].blue = QuantumRange
98
+ blue_column[y].red = 0
99
+ blue_column[y].green = 0
100
+ rgb_column[y].blue = QuantumRange
101
+ end
102
+ if yf >= HISTOGRAM_ROWS - (int[x] * scale)
103
+ int_column[y].opacity = TransparentOpacity
104
+ end
105
+ end
106
+
107
+ rgb_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, rgb_column)
108
+ red_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, red_column)
109
+ green_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, green_column)
110
+ blue_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, blue_column)
111
+ int_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, int_column)
112
+ rgb_column.reset(bg)
113
+ red_column.reset(bg)
114
+ green_column.reset(bg)
115
+ blue_column.reset(bg)
116
+ int_column.reset(bg)
117
+ end
118
+
119
+ return red_histogram, green_histogram, blue_histogram, rgb_histogram, int_histogram
120
+ end
121
+
122
+ # Make the color histogram. Quantize the image to 256 colors if necessary.
123
+ def color_hist(fg, bg)
124
+ img = number_colors > 256 ? quantize(256) : self
125
+
126
+ begin
127
+ hist = img.color_histogram
128
+ rescue NotImplementedError
129
+ $stderr.puts "The color_histogram method is not supported by this version "+
130
+ "of ImageMagick/GraphicsMagick"
131
+
132
+ else
133
+ pixels = hist.keys.sort_by {|pixel| hist[pixel] }
134
+ scale = HISTOGRAM_ROWS / (hist.values.max*AIR_FACTOR)
135
+
136
+ histogram = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) {
137
+ self.background_color = bg
138
+ self.border_color = fg
139
+ }
140
+
141
+ x = 0
142
+ pixels.each do |pixel|
143
+ column = Array.new(HISTOGRAM_ROWS).fill {Pixel.new}
144
+ HISTOGRAM_ROWS.times do |y|
145
+ if y >= HISTOGRAM_ROWS - (hist[pixel] * scale)
146
+ column[y] = pixel;
147
+ end
148
+ end
149
+ histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, column)
150
+ x = x.succ
151
+ end
152
+
153
+ histogram['Label'] = 'Color Frequency'
154
+ return histogram
155
+ end
156
+ end
157
+
158
+ # Use AnnotateImage to write the stats.
159
+ def info_text(fg, bg)
160
+ klass = class_type == DirectClass ? "DirectClass" : "PsuedoClass"
161
+
162
+ text = <<-END_TEXT
163
+ Format: #{format}
164
+ Geometry: #{columns}x#{rows}
165
+ Class: #{klass}
166
+ Depth: #{depth} bits-per-pixel component
167
+ Colors: #{number_colors}
168
+ END_TEXT
169
+
170
+ info = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) {
171
+ self.background_color = bg
172
+ self.border_color = fg
173
+ }
174
+
175
+ gc = Draw.new
176
+
177
+ gc.annotate(info, 0, 0, 0, 0, text) {
178
+ self.stroke = 'transparent'
179
+ self.fill = fg
180
+ self.gravity = CenterGravity
181
+ }
182
+ info['Label'] = 'Info'
183
+
184
+ return info
185
+ end
186
+
187
+ def intensity_hist(int_histogram)
188
+
189
+ gradient = (Image.read("gradient:#ffff80-#ff9000") { self.size="#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}" }).first
190
+ int_histogram = gradient.composite(int_histogram, CenterGravity, OverCompositeOp)
191
+
192
+ int_histogram['Label'] = 'Intensity'
193
+
194
+ return int_histogram
195
+ end
196
+
197
+ # Returns a value between 0 and MAX_QUANTUM. Same as the PixelIntensity macro.
198
+ def pixel_intensity(pixel)
199
+ (306*(pixel.red & MAX_QUANTUM) + 601*(pixel.green & MAX_QUANTUM) + 117*(pixel.blue & MAX_QUANTUM))/1024
200
+ end
201
+
202
+ public
203
+ # Create the histogram montage.
204
+ def histogram(fg='white', bg='black')
205
+
206
+ red = Array.new(HISTOGRAM_COLS, 0)
207
+ green = Array.new(HISTOGRAM_COLS, 0)
208
+ blue = Array.new(HISTOGRAM_COLS, 0)
209
+ alpha = Array.new(HISTOGRAM_COLS, 0)
210
+ int = Array.new(HISTOGRAM_COLS, 0)
211
+
212
+ rows.times do |row|
213
+ pixels = get_pixels(0, row, columns, 1)
214
+ pixels.each do |pixel|
215
+ red[pixel.red & MAX_QUANTUM] += 1
216
+ green[pixel.green & MAX_QUANTUM] += 1
217
+ blue[pixel.blue & MAX_QUANTUM] += 1
218
+
219
+ # Only count opacity channel if some pixels are not opaque.
220
+ if !opaque?
221
+ alpha[pixel.opacity & MAX_QUANTUM] += 1
222
+ end
223
+ v = pixel_intensity(pixel)
224
+ int[v] += 1
225
+ end
226
+ end
227
+
228
+ # Scale to chart size. When computing the scale, add some "air" between
229
+ # the max frequency and the top of the histogram. This makes a prettier chart.
230
+ # The RGBA and intensity histograms are all drawn to the same scale.
231
+
232
+ max = [red.max, green.max, blue.max, alpha.max, int.max].max
233
+ scale = HISTOGRAM_ROWS / (max*AIR_FACTOR)
234
+
235
+ charts = ImageList.new
236
+
237
+ # Add the thumbnail.
238
+ thumb = copy
239
+ thumb['Label'] = File.basename(filename)
240
+ charts << thumb
241
+
242
+ # Compute the channel and intensity histograms.
243
+ channel_hists = channel_histograms(red, green, blue, int, scale, fg, bg)
244
+
245
+ # Add the red, green, and blue histograms to the list
246
+ charts << channel_hists.shift
247
+ charts << channel_hists.shift
248
+ charts << channel_hists.shift
249
+
250
+ # Add Alpha channel or image stats
251
+ if !opaque?
252
+ charts << alpha_hist(alpha, scale, fg, bg)
253
+ else
254
+ charts << info_text(fg, bg)
255
+ end
256
+
257
+ # Add the RGB histogram
258
+ charts << channel_hists.shift
259
+
260
+ # Add the intensity histogram.
261
+ charts << intensity_hist(channel_hists.shift)
262
+
263
+ # Add the color frequency histogram.
264
+ charts << color_hist(fg, bg)
265
+
266
+ # Make a montage.
267
+ histogram = charts.montage {
268
+ self.background_color = bg
269
+ self.stroke = 'transparent'
270
+ self.fill = fg
271
+ self.border_width = 1
272
+ self.tile = "4x2"
273
+ self.geometry = "#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}+10+10"
274
+ }
275
+
276
+ return histogram
277
+ end
278
+ end
279
+ end
280
+
281
+ puts <<END_INFO
282
+
283
+ This example shows how to get pixel-level access to an image.
284
+ Usage: histogram.rb <image-filename>
285
+
286
+ END_INFO
287
+
288
+ # Get filename from command line.
289
+ if !ARGV[0] then
290
+ puts "No filename argument. Defaulting to Flower_Hat.jpg"
291
+ filename = '../doc/ex/images/Flower_Hat.jpg'
292
+ else
293
+ filename = ARGV[0]
294
+ end
295
+
296
+ # Only process first frame if multi-frame image
297
+ image = Magick::Image.read(filename)
298
+ if image.length > 1
299
+ puts "Charting 1st image"
300
+ end
301
+ image = image.first
302
+
303
+ # Give the user something to look at while we're working.
304
+ name = File.basename(filename).sub(/\..*?$/,'')
305
+ $defout.sync = true
306
+ printf "Creating #{name}_Histogram.miff"
307
+
308
+ timer = Thread.new do
309
+ loop do
310
+ sleep(1)
311
+ printf "."
312
+ end
313
+ end
314
+
315
+ # Generate the histograms
316
+ histogram = image.histogram(Magick::Pixel.from_color('white'), Magick::Pixel.from_color('black'))
317
+
318
+ # Write output file
319
+ histogram.compression = Magick::ZipCompression
320
+ histogram.write("./#{name}_Histogram.miff")
321
+
322
+ Thread.kill(timer)
323
+ puts "Done!"
324
+ exit
325
+
@@ -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::QuantumRange / (Magick::QuantumRange >> (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::QuantumRange)
41
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[1]/scale, channel_extrema(Magick::RedChannel)[1]/Magick::QuantumRange)
42
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[0]/scale, channel_mean(Magick::RedChannel)[0]/Magick::QuantumRange)
43
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[1]/scale, channel_mean(Magick::RedChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
46
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[1]/scale, channel_extrema(Magick::GreenChannel)[1]/Magick::QuantumRange)
47
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[0]/scale, channel_mean(Magick::GreenChannel)[0]/Magick::QuantumRange)
48
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[1]/scale, channel_mean(Magick::GreenChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
51
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[1]/scale, channel_extrema(Magick::BlueChannel)[1]/Magick::QuantumRange)
52
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[0]/scale, channel_mean(Magick::BlueChannel)[0]/Magick::QuantumRange)
53
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[1]/scale, channel_mean(Magick::BlueChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
57
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[1]/scale, channel_extrema(Magick::CyanChannel)[1]/Magick::QuantumRange)
58
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[0]/scale, channel_mean(Magick::CyanChannel)[0]/Magick::QuantumRange)
59
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[1]/scale, channel_mean(Magick::CyanChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
62
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[1]/scale, channel_extrema(Magick::MagentaChannel)[1]/Magick::QuantumRange)
63
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[0]/scale, channel_mean(Magick::MagentaChannel)[0]/Magick::QuantumRange)
64
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[1]/scale, channel_mean(Magick::MagentaChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
67
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[1]/scale, channel_extrema(Magick::YellowChannel)[1]/Magick::QuantumRange)
68
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[0]/scale, channel_mean(Magick::YellowChannel)[0]/Magick::QuantumRange)
69
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[1]/scale, channel_mean(Magick::YellowChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
72
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[1]/scale, channel_extrema(Magick::BlackChannel)[1]/Magick::QuantumRange)
73
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[0]/scale, channel_mean(Magick::BlackChannel)[0]/Magick::QuantumRange)
74
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[1]/scale, channel_mean(Magick::BlackChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
78
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[1]/scale, channel_extrema(Magick::GrayChannel)[1]/Magick::QuantumRange)
79
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[0]/scale, channel_mean(Magick::GrayChannel)[0]/Magick::QuantumRange)
80
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[1]/scale, channel_mean(Magick::GrayChannel)[1]/Magick::QuantumRange)
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::QuantumRange)
85
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[1]/scale, channel_extrema(Magick::OpacityChannel)[1]/Magick::QuantumRange)
86
+ puts "\t\t\tMean:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[0]/scale, channel_mean(Magick::OpacityChannel)[0]/Magick::QuantumRange)
87
+ puts "\t\t\tStandard deviation:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[1]/scale, channel_mean(Magick::OpacityChannel)[1]/Magick::QuantumRange)
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
+