rmagick 4.1.0.rc2 → 4.1.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 (412) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +63 -0
  3. data/.editorconfig +3 -0
  4. data/.github/workflows/ci.yml +148 -0
  5. data/.gitignore +3 -1
  6. data/.rspec +1 -0
  7. data/.rubocop.yml +24 -0
  8. data/.rubocop_todo.yml +80 -270
  9. data/.yardopts +5 -0
  10. data/CHANGELOG.md +63 -0
  11. data/CONTRIBUTING.md +14 -10
  12. data/README.md +292 -0
  13. data/Rakefile +16 -22
  14. data/before_install_linux.sh +22 -32
  15. data/before_install_osx.sh +56 -2
  16. data/ext/RMagick/extconf.rb +100 -94
  17. data/ext/RMagick/rmagick.c +77 -104
  18. data/ext/RMagick/rmagick.h +74 -70
  19. data/ext/RMagick/rmdraw.c +261 -444
  20. data/ext/RMagick/rmenum.c +96 -113
  21. data/ext/RMagick/rmfill.c +46 -77
  22. data/ext/RMagick/rmilist.c +136 -244
  23. data/ext/RMagick/rmimage.c +3395 -4166
  24. data/ext/RMagick/rminfo.c +531 -737
  25. data/ext/RMagick/rmkinfo.c +21 -87
  26. data/ext/RMagick/rmmain.c +405 -245
  27. data/ext/RMagick/rmmontage.c +60 -126
  28. data/ext/RMagick/rmpixel.c +401 -345
  29. data/ext/RMagick/rmstruct.c +62 -88
  30. data/ext/RMagick/rmutil.c +112 -218
  31. data/lib/rmagick/version.rb +1 -1
  32. data/lib/rmagick_internal.rb +128 -77
  33. data/lib/rvg/clippath.rb +2 -1
  34. data/lib/rvg/container.rb +10 -5
  35. data/lib/rvg/describable.rb +1 -1
  36. data/lib/rvg/embellishable.rb +5 -4
  37. data/lib/rvg/misc.rb +15 -12
  38. data/lib/rvg/paint.rb +2 -1
  39. data/lib/rvg/pathdata.rb +12 -11
  40. data/lib/rvg/rvg.rb +8 -4
  41. data/lib/rvg/stylable.rb +9 -7
  42. data/lib/rvg/text.rb +11 -6
  43. data/lib/rvg/transformable.rb +3 -2
  44. data/lib/rvg/units.rb +1 -1
  45. data/rmagick.gemspec +7 -6
  46. metadata +31 -421
  47. data/.appveyor.yml +0 -57
  48. data/.circleci/config.yml +0 -56
  49. data/.ruby-version +0 -1
  50. data/.simplecov +0 -27
  51. data/.travis.yml +0 -64
  52. data/Doxyfile +0 -1514
  53. data/README.textile +0 -259
  54. data/benchmarks/memory/README.md +0 -50
  55. data/benchmarks/memory/image_new.rb +0 -8
  56. data/benchmarks/memory/rmagick.gnuplot +0 -16
  57. data/doc/.cvsignore +0 -1
  58. data/doc/comtasks.html +0 -287
  59. data/doc/constants.html +0 -1581
  60. data/doc/css/doc.css +0 -299
  61. data/doc/css/popup.css +0 -34
  62. data/doc/css/ref.css +0 -67
  63. data/doc/draw.html +0 -3272
  64. data/doc/ex/InitialCoords.rb +0 -22
  65. data/doc/ex/NewCoordSys.rb +0 -30
  66. data/doc/ex/OrigCoordSys.rb +0 -16
  67. data/doc/ex/PreserveAspectRatio.rb +0 -204
  68. data/doc/ex/RotateScale.rb +0 -36
  69. data/doc/ex/Skew.rb +0 -38
  70. data/doc/ex/Use01.rb +0 -15
  71. data/doc/ex/Use02.rb +0 -20
  72. data/doc/ex/Use03.rb +0 -16
  73. data/doc/ex/ViewBox.rb +0 -31
  74. data/doc/ex/adaptive_threshold.rb +0 -9
  75. data/doc/ex/add_noise.rb +0 -16
  76. data/doc/ex/affine.rb +0 -48
  77. data/doc/ex/affine_transform.rb +0 -20
  78. data/doc/ex/arc.rb +0 -49
  79. data/doc/ex/arcpath.rb +0 -32
  80. data/doc/ex/arcs01.rb +0 -28
  81. data/doc/ex/arcs02.rb +0 -59
  82. data/doc/ex/average.rb +0 -15
  83. data/doc/ex/axes.rb +0 -64
  84. data/doc/ex/baseline_shift01.rb +0 -17
  85. data/doc/ex/bilevel_channel.rb +0 -8
  86. data/doc/ex/blur_image.rb +0 -12
  87. data/doc/ex/border.rb +0 -10
  88. data/doc/ex/bounding_box.rb +0 -42
  89. data/doc/ex/cbezier1.rb +0 -41
  90. data/doc/ex/cbezier2.rb +0 -41
  91. data/doc/ex/cbezier3.rb +0 -41
  92. data/doc/ex/cbezier4.rb +0 -42
  93. data/doc/ex/cbezier5.rb +0 -42
  94. data/doc/ex/cbezier6.rb +0 -53
  95. data/doc/ex/channel.rb +0 -25
  96. data/doc/ex/charcoal.rb +0 -12
  97. data/doc/ex/chop.rb +0 -29
  98. data/doc/ex/circle.rb +0 -33
  99. data/doc/ex/circle01.rb +0 -16
  100. data/doc/ex/clip_path.rb +0 -60
  101. data/doc/ex/coalesce.rb +0 -57
  102. data/doc/ex/color_fill_to_border.rb +0 -29
  103. data/doc/ex/color_floodfill.rb +0 -28
  104. data/doc/ex/color_histogram.rb +0 -47
  105. data/doc/ex/color_reset.rb +0 -11
  106. data/doc/ex/colorize.rb +0 -16
  107. data/doc/ex/colors.rb +0 -64
  108. data/doc/ex/compose_mask.rb +0 -22
  109. data/doc/ex/composite.rb +0 -133
  110. data/doc/ex/composite_layers.rb +0 -52
  111. data/doc/ex/composite_tiled.rb +0 -21
  112. data/doc/ex/contrast.rb +0 -36
  113. data/doc/ex/crop.rb +0 -31
  114. data/doc/ex/crop_with_gravity.rb +0 -42
  115. data/doc/ex/cubic01.rb +0 -43
  116. data/doc/ex/cubic02.rb +0 -91
  117. data/doc/ex/cycle_colormap.rb +0 -21
  118. data/doc/ex/dissolve.rb +0 -12
  119. data/doc/ex/drawcomp.rb +0 -41
  120. data/doc/ex/drop_shadow.rb +0 -60
  121. data/doc/ex/edge.rb +0 -11
  122. data/doc/ex/ellipse.rb +0 -45
  123. data/doc/ex/ellipse01.rb +0 -21
  124. data/doc/ex/emboss.rb +0 -11
  125. data/doc/ex/enhance.rb +0 -28
  126. data/doc/ex/equalize.rb +0 -11
  127. data/doc/ex/evenodd.rb +0 -42
  128. data/doc/ex/fill_pattern.rb +0 -23
  129. data/doc/ex/flatten_images.rb +0 -36
  130. data/doc/ex/flip.rb +0 -11
  131. data/doc/ex/flop.rb +0 -11
  132. data/doc/ex/font_styles.rb +0 -32
  133. data/doc/ex/fonts.rb +0 -16
  134. data/doc/ex/frame.rb +0 -12
  135. data/doc/ex/gaussian_blur.rb +0 -11
  136. data/doc/ex/get_multiline_type_metrics.rb +0 -41
  137. data/doc/ex/get_pixels.rb +0 -45
  138. data/doc/ex/get_type_metrics.rb +0 -142
  139. data/doc/ex/gradientfill.rb +0 -27
  140. data/doc/ex/grav.rb +0 -45
  141. data/doc/ex/gravity.rb +0 -78
  142. data/doc/ex/group.rb +0 -26
  143. data/doc/ex/hatchfill.rb +0 -27
  144. data/doc/ex/image.rb +0 -44
  145. data/doc/ex/images/Apple.miff +0 -0
  146. data/doc/ex/images/Ballerina.jpg +0 -0
  147. data/doc/ex/images/Ballerina3.jpg +0 -0
  148. data/doc/ex/images/Button_0.gif +0 -0
  149. data/doc/ex/images/Button_1.gif +0 -0
  150. data/doc/ex/images/Button_2.gif +0 -0
  151. data/doc/ex/images/Button_3.gif +0 -0
  152. data/doc/ex/images/Button_4.gif +0 -0
  153. data/doc/ex/images/Button_5.gif +0 -0
  154. data/doc/ex/images/Button_6.gif +0 -0
  155. data/doc/ex/images/Button_7.gif +0 -0
  156. data/doc/ex/images/Button_8.gif +0 -0
  157. data/doc/ex/images/Button_9.gif +0 -0
  158. data/doc/ex/images/Button_A.gif +0 -0
  159. data/doc/ex/images/Button_B.gif +0 -0
  160. data/doc/ex/images/Button_C.gif +0 -0
  161. data/doc/ex/images/Button_D.gif +0 -0
  162. data/doc/ex/images/Button_E.gif +0 -0
  163. data/doc/ex/images/Button_F.gif +0 -0
  164. data/doc/ex/images/Button_G.gif +0 -0
  165. data/doc/ex/images/Button_H.gif +0 -0
  166. data/doc/ex/images/Button_I.gif +0 -0
  167. data/doc/ex/images/Button_J.gif +0 -0
  168. data/doc/ex/images/Button_K.gif +0 -0
  169. data/doc/ex/images/Button_L.gif +0 -0
  170. data/doc/ex/images/Button_M.gif +0 -0
  171. data/doc/ex/images/Button_N.gif +0 -0
  172. data/doc/ex/images/Button_O.gif +0 -0
  173. data/doc/ex/images/Button_P.gif +0 -0
  174. data/doc/ex/images/Button_Q.gif +0 -0
  175. data/doc/ex/images/Button_R.gif +0 -0
  176. data/doc/ex/images/Button_S.gif +0 -0
  177. data/doc/ex/images/Button_T.gif +0 -0
  178. data/doc/ex/images/Button_U.gif +0 -0
  179. data/doc/ex/images/Button_V.gif +0 -0
  180. data/doc/ex/images/Button_W.gif +0 -0
  181. data/doc/ex/images/Button_X.gif +0 -0
  182. data/doc/ex/images/Button_Y.gif +0 -0
  183. data/doc/ex/images/Button_Z.gif +0 -0
  184. data/doc/ex/images/Cheetah.jpg +0 -0
  185. data/doc/ex/images/Coffee.png +0 -0
  186. data/doc/ex/images/Flower_Hat.jpg +0 -0
  187. data/doc/ex/images/Gold_Statue.jpg +0 -0
  188. data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
  189. data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
  190. data/doc/ex/images/Leaf.miff +0 -0
  191. data/doc/ex/images/No.png +0 -0
  192. data/doc/ex/images/Polynesia.jpg +0 -0
  193. data/doc/ex/images/Red_Rocks.jpg +0 -0
  194. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  195. data/doc/ex/images/Shorts.jpg +0 -0
  196. data/doc/ex/images/Snake.png +0 -0
  197. data/doc/ex/images/Violin.jpg +0 -0
  198. data/doc/ex/images/Yellow_Rose.miff +0 -0
  199. data/doc/ex/images/big-duck.gif +0 -0
  200. data/doc/ex/images/duck.gif +0 -0
  201. data/doc/ex/images/duck0.gif +0 -0
  202. data/doc/ex/images/duck1.gif +0 -0
  203. data/doc/ex/images/duck10.gif +0 -0
  204. data/doc/ex/images/duck11.gif +0 -0
  205. data/doc/ex/images/duck12.gif +0 -0
  206. data/doc/ex/images/duck13.gif +0 -0
  207. data/doc/ex/images/duck14.gif +0 -0
  208. data/doc/ex/images/duck15.gif +0 -0
  209. data/doc/ex/images/duck2.gif +0 -0
  210. data/doc/ex/images/duck3.gif +0 -0
  211. data/doc/ex/images/duck4.gif +0 -0
  212. data/doc/ex/images/duck5.gif +0 -0
  213. data/doc/ex/images/duck6.gif +0 -0
  214. data/doc/ex/images/duck7.gif +0 -0
  215. data/doc/ex/images/duck8.gif +0 -0
  216. data/doc/ex/images/duck9.gif +0 -0
  217. data/doc/ex/images/graydient230x6.gif +0 -0
  218. data/doc/ex/images/image_with_profile.jpg +0 -0
  219. data/doc/ex/images/logo400x83.gif +0 -0
  220. data/doc/ex/images/model.miff +0 -0
  221. data/doc/ex/images/notimplemented.gif +0 -0
  222. data/doc/ex/images/smile.miff +0 -0
  223. data/doc/ex/images/spin.gif +0 -0
  224. data/doc/ex/implode.rb +0 -34
  225. data/doc/ex/level.rb +0 -11
  226. data/doc/ex/level_colors.rb +0 -11
  227. data/doc/ex/line.rb +0 -41
  228. data/doc/ex/line01.rb +0 -21
  229. data/doc/ex/mask.rb +0 -35
  230. data/doc/ex/matte_fill_to_border.rb +0 -39
  231. data/doc/ex/matte_floodfill.rb +0 -32
  232. data/doc/ex/matte_replace.rb +0 -39
  233. data/doc/ex/median_filter.rb +0 -28
  234. data/doc/ex/modulate.rb +0 -11
  235. data/doc/ex/mono.rb +0 -23
  236. data/doc/ex/morph.rb +0 -25
  237. data/doc/ex/mosaic.rb +0 -37
  238. data/doc/ex/motion_blur.rb +0 -11
  239. data/doc/ex/negate.rb +0 -11
  240. data/doc/ex/negate_channel.rb +0 -9
  241. data/doc/ex/nested_rvg.rb +0 -21
  242. data/doc/ex/nonzero.rb +0 -42
  243. data/doc/ex/normalize.rb +0 -11
  244. data/doc/ex/oil_paint.rb +0 -11
  245. data/doc/ex/opacity.rb +0 -37
  246. data/doc/ex/ordered_dither.rb +0 -11
  247. data/doc/ex/path.rb +0 -63
  248. data/doc/ex/pattern1.rb +0 -25
  249. data/doc/ex/pattern2.rb +0 -26
  250. data/doc/ex/polaroid.rb +0 -26
  251. data/doc/ex/polygon.rb +0 -23
  252. data/doc/ex/polygon01.rb +0 -21
  253. data/doc/ex/polyline.rb +0 -22
  254. data/doc/ex/polyline01.rb +0 -21
  255. data/doc/ex/posterize.rb +0 -8
  256. data/doc/ex/preview.rb +0 -8
  257. data/doc/ex/qbezierpath.rb +0 -52
  258. data/doc/ex/quad01.rb +0 -34
  259. data/doc/ex/quantize-m.rb +0 -25
  260. data/doc/ex/radial_blur.rb +0 -9
  261. data/doc/ex/raise.rb +0 -8
  262. data/doc/ex/random_threshold_channel.rb +0 -13
  263. data/doc/ex/rect01.rb +0 -14
  264. data/doc/ex/rect02.rb +0 -20
  265. data/doc/ex/rectangle.rb +0 -34
  266. data/doc/ex/reduce_noise.rb +0 -28
  267. data/doc/ex/remap.rb +0 -11
  268. data/doc/ex/remap_images.rb +0 -19
  269. data/doc/ex/resize_to_fill.rb +0 -8
  270. data/doc/ex/resize_to_fit.rb +0 -8
  271. data/doc/ex/roll.rb +0 -9
  272. data/doc/ex/rotate.rb +0 -44
  273. data/doc/ex/rotate_f.rb +0 -14
  274. data/doc/ex/roundrect.rb +0 -33
  275. data/doc/ex/rubyname.rb +0 -30
  276. data/doc/ex/rvg_clippath.rb +0 -12
  277. data/doc/ex/rvg_linecap.rb +0 -42
  278. data/doc/ex/rvg_linejoin.rb +0 -40
  279. data/doc/ex/rvg_opacity.rb +0 -18
  280. data/doc/ex/rvg_pattern.rb +0 -26
  281. data/doc/ex/rvg_stroke_dasharray.rb +0 -11
  282. data/doc/ex/segment.rb +0 -11
  283. data/doc/ex/sepiatone.rb +0 -7
  284. data/doc/ex/shade.rb +0 -11
  285. data/doc/ex/shadow.rb +0 -30
  286. data/doc/ex/shave.rb +0 -15
  287. data/doc/ex/shear.rb +0 -10
  288. data/doc/ex/sketch.rb +0 -17
  289. data/doc/ex/skewx.rb +0 -51
  290. data/doc/ex/skewy.rb +0 -47
  291. data/doc/ex/smile.rb +0 -126
  292. data/doc/ex/solarize.rb +0 -11
  293. data/doc/ex/sparse_color.rb +0 -55
  294. data/doc/ex/splice.rb +0 -8
  295. data/doc/ex/spread.rb +0 -11
  296. data/doc/ex/stegano.rb +0 -54
  297. data/doc/ex/stroke_dasharray.rb +0 -42
  298. data/doc/ex/stroke_fill.rb +0 -10
  299. data/doc/ex/stroke_linecap.rb +0 -44
  300. data/doc/ex/stroke_linejoin.rb +0 -48
  301. data/doc/ex/stroke_width.rb +0 -49
  302. data/doc/ex/swirl.rb +0 -17
  303. data/doc/ex/text.rb +0 -37
  304. data/doc/ex/text01.rb +0 -16
  305. data/doc/ex/text_align.rb +0 -36
  306. data/doc/ex/text_antialias.rb +0 -37
  307. data/doc/ex/text_styles.rb +0 -19
  308. data/doc/ex/text_undercolor.rb +0 -28
  309. data/doc/ex/texture_fill_to_border.rb +0 -34
  310. data/doc/ex/texture_floodfill.rb +0 -32
  311. data/doc/ex/texturefill.rb +0 -24
  312. data/doc/ex/threshold.rb +0 -13
  313. data/doc/ex/to_blob.rb +0 -13
  314. data/doc/ex/translate.rb +0 -39
  315. data/doc/ex/transparent.rb +0 -38
  316. data/doc/ex/transpose.rb +0 -9
  317. data/doc/ex/transverse.rb +0 -9
  318. data/doc/ex/tref01.rb +0 -24
  319. data/doc/ex/triangle01.rb +0 -15
  320. data/doc/ex/trim.rb +0 -23
  321. data/doc/ex/tspan01.rb +0 -17
  322. data/doc/ex/tspan02.rb +0 -17
  323. data/doc/ex/tspan03.rb +0 -19
  324. data/doc/ex/unsharp_mask.rb +0 -28
  325. data/doc/ex/viewex.rb +0 -33
  326. data/doc/ex/vignette.rb +0 -12
  327. data/doc/ex/watermark.rb +0 -27
  328. data/doc/ex/wave.rb +0 -9
  329. data/doc/ex/wet_floor.rb +0 -58
  330. data/doc/ex/writing_mode01.rb +0 -26
  331. data/doc/ex/writing_mode02.rb +0 -26
  332. data/doc/ilist.html +0 -2056
  333. data/doc/image1.html +0 -4680
  334. data/doc/image2.html +0 -3665
  335. data/doc/image3.html +0 -4522
  336. data/doc/imageattrs.html +0 -1638
  337. data/doc/imusage.html +0 -514
  338. data/doc/index.html +0 -416
  339. data/doc/info.html +0 -1499
  340. data/doc/magick.html +0 -570
  341. data/doc/optequiv.html +0 -2435
  342. data/doc/rvg.html +0 -975
  343. data/doc/rvgclip.html +0 -248
  344. data/doc/rvggroup.html +0 -305
  345. data/doc/rvgimage.html +0 -289
  346. data/doc/rvgpattern.html +0 -475
  347. data/doc/rvgshape.html +0 -406
  348. data/doc/rvgstyle.html +0 -270
  349. data/doc/rvgtext.html +0 -465
  350. data/doc/rvgtspan.html +0 -238
  351. data/doc/rvgtut.html +0 -530
  352. data/doc/rvguse.html +0 -145
  353. data/doc/rvgxform.html +0 -294
  354. data/doc/scripts/doc.js +0 -22
  355. data/doc/scripts/stripeTables.js +0 -23
  356. data/doc/struct.html +0 -1339
  357. data/doc/usage.html +0 -1621
  358. data/examples/constitute.rb +0 -7
  359. data/examples/crop_with_gravity.rb +0 -43
  360. data/examples/demo.rb +0 -323
  361. data/examples/describe.rb +0 -41
  362. data/examples/find_similar_region.rb +0 -34
  363. data/examples/histogram.rb +0 -312
  364. data/examples/identify.rb +0 -174
  365. data/examples/image_opacity.rb +0 -28
  366. data/examples/import_export.rb +0 -31
  367. data/examples/pattern_fill.rb +0 -37
  368. data/examples/rotating_text.rb +0 -45
  369. data/examples/spinner.rb +0 -49
  370. data/examples/thumbnail.rb +0 -64
  371. data/examples/vignette.rb +0 -78
  372. data/spec/rmagick/ImageList1_spec.rb +0 -24
  373. data/spec/rmagick/draw_spec.rb +0 -155
  374. data/spec/rmagick/image/blue_shift_spec.rb +0 -14
  375. data/spec/rmagick/image/channel_entropy_spec.rb +0 -9
  376. data/spec/rmagick/image/composite_spec.rb +0 -72
  377. data/spec/rmagick/image/constitute_spec.rb +0 -13
  378. data/spec/rmagick/image/dispatch_spec.rb +0 -16
  379. data/spec/rmagick/image/dissolve_spec.rb +0 -54
  380. data/spec/rmagick/image/from_blob_spec.rb +0 -12
  381. data/spec/rmagick/image/ping_spec.rb +0 -12
  382. data/spec/rmagick/image/properties_spec.rb +0 -27
  383. data/spec/rmagick/image/read_spec.rb +0 -28
  384. data/spec/spec_helper.rb +0 -9
  385. data/spec/support/issue_200/app.rb +0 -8
  386. data/test/Draw.rb +0 -351
  387. data/test/Enum.rb +0 -228
  388. data/test/Fill.rb +0 -93
  389. data/test/Image1.rb +0 -606
  390. data/test/Image2.rb +0 -1408
  391. data/test/Image3.rb +0 -1086
  392. data/test/ImageList1.rb +0 -858
  393. data/test/ImageList2.rb +0 -375
  394. data/test/Image_attributes.rb +0 -635
  395. data/test/Import_Export.rb +0 -111
  396. data/test/Info.rb +0 -436
  397. data/test/KernelInfo.rb +0 -59
  398. data/test/Magick.rb +0 -311
  399. data/test/Pixel.rb +0 -259
  400. data/test/PolaroidOptions.rb +0 -23
  401. data/test/Preview.rb +0 -26
  402. data/test/Struct.rb +0 -45
  403. data/test/appearance/Montage.rb +0 -26
  404. data/test/appearance/appearance_assertion.rb +0 -13
  405. data/test/appearance/expected/montage_border_color.jpg +0 -0
  406. data/test/cmyk.icm +0 -0
  407. data/test/lib/internal/Draw.rb +0 -811
  408. data/test/lib/internal/Geometry.rb +0 -98
  409. data/test/lib/internal/Magick.rb +0 -40
  410. data/test/srgb.icm +0 -0
  411. data/test/test_all_basic.rb +0 -49
  412. data/test/tmpnam_test.rb +0 -50
@@ -1,4522 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml">
5
- <head>
6
- <meta name="generator" content=
7
- "HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org" />
8
-
9
- <title>RMagick 0.0.0: class Image (instance methods p-w)</title>
10
- <meta http-equiv="Content-Type" content=
11
- "text/html; charset=us-ascii" />
12
- <meta name="GENERATOR" content="Quanta Plus" />
13
- <meta name="Copyright" content=
14
- "Copyright (C) 2006 by Timothy P. Hunter" />
15
- <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
- <script type="text/javascript" src="scripts/doc.js">
17
- </script>
18
- <script type="text/javascript">
19
- //<![CDATA[
20
- <!-- Pre-load this image so that the browser knows how big it is. -->
21
- <!-- Begin
22
- flower_hat = new Image();
23
- flower_hat.src = "ex/images/Flower_Hat.jpg";
24
- // End -->
25
- //]]>
26
- </script>
27
- <style type="text/css">
28
- /*<![CDATA[*/
29
-
30
- /*
31
- * This style is used for the list of PreviewType
32
- * constants defined for the preview method, below.
33
- */
34
- #prevlist ul {
35
- float: left;
36
- list-style: none;
37
- margin-bottom: 0;
38
- }
39
-
40
- /*
41
- * This style is used for the list of QuantumOperator
42
- * constants defined for the quantum_operator method, below.
43
- *
44
- */
45
- #quantum_op_list {
46
- list-style-type: none;
47
- }
48
-
49
- /*]]>*/
50
- </style>
51
- </head>
52
-
53
- <body>
54
- <h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
55
-
56
- <div class="nav">
57
- &laquo;&nbsp;<a href="image2.html">Prev</a> | <a href=
58
- "index.html">Contents</a> | <a href=
59
- "draw.html">Next</a>&nbsp;&raquo;
60
- </div>
61
-
62
- <h1>class Image <span class="superclass">&lt; Object</span>
63
- (instance methods p-w)<br />
64
- <span class="mixin">mixes in Comparable</span></h1>
65
-
66
- <div id="toc">
67
- <h2>Table of Contents</h2>
68
-
69
- <h3>instance methods</h3>
70
-
71
- <div>
72
- <div class="toccol">
73
- <ul>
74
- <li><a href="#palette_q">palette?</a></li>
75
-
76
- <li><a href=
77
- "#paint_transparent">paint_transparent</a></li>
78
-
79
- <li><a href="#pixel_color">pixel_color</a></li>
80
-
81
- <li><a href="#polaroid">polaroid</a></li>
82
-
83
- <li><a href="#posterize">posterize</a></li>
84
-
85
- <li><a href="#preview">preview</a></li>
86
-
87
- <li><a href="#profile_bang">profile!</a></li>
88
-
89
- <li><a href="#properties">properties</a></li>
90
-
91
- <li><a href="#quantize">quantize</a></li>
92
-
93
- <li><a href="#quantum_operator">quantum_operator</a></li>
94
-
95
- <li><a href="#radial_blur">radial_blur</a></li>
96
-
97
- <li><a href=
98
- "#radial_blur_channel">radial_blur_channel</a></li>
99
-
100
- <li><a href="#raise">raise</a></li>
101
-
102
- <li><a href=
103
- "#random_threshold_channel">random_threshold_channel</a></li>
104
-
105
- <li><a href="#recolor">recolor</a></li>
106
-
107
- <li><a href="#reduce_noise">reduce_noise</a></li>
108
-
109
- <li><a href="#remap">remap</a></li>
110
-
111
- <li><a href="#resample">resample</a></li>
112
-
113
- <li><a href="#resize">resize</a></li>
114
-
115
- <li><a href="#resize_bang">resize!</a></li>
116
-
117
- <li><a href="#resize_to_fill">resize_to_fill</a></li>
118
-
119
- <li><a href=
120
- "#resize_to_fill_bang">resize_to_fill!</a></li>
121
-
122
- <li><a href="#resize_to_fit">resize_to_fit</a></li>
123
-
124
- <li><a href="#resize_to_fit_bang">resize_to_fit!</a></li>
125
-
126
- <li><a href="#roll">roll</a></li>
127
-
128
- <li><a href="#rotate">rotate</a></li>
129
-
130
- <li><a href="#rotate_bang">rotate!</a></li>
131
- </ul>
132
- </div>
133
-
134
- <div class="toccol">
135
- <ul>
136
- <li><a href="#sample">sample</a></li>
137
-
138
- <li><a href="#sample_bang">sample!</a></li>
139
-
140
- <li><a href="#scale">scale</a></li>
141
-
142
- <li><a href="#scale_bang">scale!</a></li>
143
-
144
- <li><a href="#segment">segment</a></li>
145
-
146
- <li><a href=
147
- "#selective_blur_channel">selective_blur_channel</a></li>
148
-
149
- <li><a href="#separate">separate</a></li>
150
-
151
- <li><a href="#sepiatone">sepiatone</a></li>
152
-
153
- <li><a href=
154
- "#set_channel_depth">set_channel_depth</a></li>
155
-
156
- <li><a href="#shade">shade</a></li>
157
-
158
- <li><a href="#shadow">shadow</a></li>
159
-
160
- <li><a href="#sharpen">sharpen</a></li>
161
-
162
- <li><a href="#sharpen_channel">sharpen_channel</a></li>
163
-
164
- <li><a href="#shave">shave</a></li>
165
-
166
- <li><a href="#shave_bang">shave!</a></li>
167
-
168
- <li><a href="#shear">shear</a></li>
169
-
170
- <li><a href=
171
- "#sigmoidal_contrast_channel">sigmoidal_contrast_channel</a></li>
172
-
173
- <li><a href="#signature">signature</a></li>
174
-
175
- <li><a href="#sketch">sketch</a></li>
176
-
177
- <li><a href="#solarize">solarize</a></li>
178
-
179
- <li><a href="#sparse_color">sparse_color</a></li>
180
-
181
- <li><a href="#splice">splice</a></li>
182
-
183
- <li><a href="#spread">spread</a></li>
184
-
185
- <li><a href="#stegano">stegano</a></li>
186
-
187
- <li><a href="#stereo">stereo</a></li>
188
-
189
- <li><a href="#store_pixels">store_pixels</a></li>
190
-
191
- <li><a href="#strip_bang">strip!</a></li>
192
- </ul>
193
- </div>
194
-
195
- <div class="toccol">
196
- <ul>
197
- <li><a href="#swirl">swirl</a></li>
198
-
199
- <li><a href="#sync_profiles">sync_profiles</a></li>
200
-
201
- <li><a href=
202
- "#texture_fill_to_border">texture_fill_to_border</a></li>
203
-
204
- <li><a href=
205
- "#texture_floodfill">texture_floodfill</a></li>
206
-
207
- <li><a href="#threshold">threshold</a></li>
208
-
209
- <li><a href="#thumbnail">thumbnail</a></li>
210
-
211
- <li><a href="#thumbnail_bang">thumbnail!</a></li>
212
-
213
- <li><a href="#to_blob">to_blob</a></li>
214
-
215
- <li><a href="#to_color">to_color</a></li>
216
-
217
- <li><a href="#transparent">transparent</a></li>
218
-
219
- <li><a href=
220
- "#transparent_chroma">transparent_chroma</a></li>
221
-
222
- <li><a href="#transpose">transpose</a></li>
223
-
224
- <li><a href="#transpose_bang">transpose!</a></li>
225
-
226
- <li><a href="#transverse">transverse</a></li>
227
-
228
- <li><a href="#transverse_bang">transverse!</a></li>
229
-
230
- <li><a href="#trim">trim</a></li>
231
-
232
- <li><a href="#trim_bang">trim!</a></li>
233
-
234
- <li><a href="#unique_colors">unique_colors</a></li>
235
-
236
- <li><a href="#unsharp_mask">unsharp_mask</a></li>
237
-
238
- <li><a href=
239
- "#unsharp_mask_channel">unsharp_mask_channel</a></li>
240
-
241
- <li><a href="#view">view</a></li>
242
-
243
- <li><a href="#vignette">vignette</a></li>
244
-
245
- <li><a href="#watermark">watermark</a></li>
246
-
247
- <li><a href="#wave">wave</a></li>
248
-
249
- <li><a href="#wet_floor">wet_floor</a></li>
250
-
251
- <li><a href="#white_threshold">white_threshold</a></li>
252
-
253
- <li><a href="#write">write</a></li>
254
- </ul>
255
- </div>
256
- </div>
257
- </div>
258
-
259
- <h2 class="methods">instance methods</h2>
260
-
261
- <div class="sig">
262
- <h3 id="palette_q">palette?</h3>
263
-
264
- <p><span class="arg">img</span>.palette? -&gt; true or
265
- false</p>
266
- </div>
267
-
268
- <div class="desc">
269
- <h4>Description</h4>
270
-
271
- <p class="imquote">Returns true if the image is <a href=
272
- "constants.html#ClassType">PseudoClass</a> and has 256 unique
273
- colors or less.</p>
274
-
275
- <h4>Returns</h4>
276
-
277
- <p>true or false</p>
278
-
279
- <h4>Magick API</h4>
280
-
281
- <p>IsPaletteImage</p>
282
- </div>
283
-
284
- <div class="sig">
285
- <h3 id="paint_transparent">paint_transparent</h3>
286
-
287
- <p><span class="arg">img</span>.paint_transparent(<span class=
288
- "arg">color</span>, <span class=
289
- "arg">opacity</span>=TransparentOpacity, <span class=
290
- "arg">invert</span>=false, <span class=
291
- "arg">fuzz</span>=<span class="arg">img</span>.fuzz) -&gt;
292
- <em>image</em></p>
293
- </div>
294
-
295
- <div class="desc">
296
- <h4>Description</h4>
297
-
298
- <p>Changes the opacity value of all the pixels that match
299
- <span class="arg">color</span> to the value specified by
300
- <span class="arg">opacity</span>. If <span class=
301
- "arg">invert</span> is true, changes the pixels that don't
302
- match <span class="arg">color</span>.</p>
303
-
304
- <h4>Arguments</h4>
305
-
306
- <dl>
307
- <dt>color</dt>
308
-
309
- <dd>Either a <a href="imusage.html#color_names">color
310
- name</a> or a <a href="struct.html#Pixel">pixel</a>.</dd>
311
-
312
- <dt>opacity</dt>
313
-
314
- <dd>The new opacity value, either an <a href=
315
- "constants.html#Opacity">opacity</a> value or a number
316
- between 0 and QuantumRange. The default is
317
- TransparentOpacity.</dd>
318
-
319
- <dt>invert</dt>
320
-
321
- <dd>If true, changes all the pixels that are <em>not</em> the
322
- target color.</dd>
323
-
324
- <dt>fuzz</dt>
325
-
326
- <dd>By default the pixel must match exactly, but you can
327
- specify a tolerance level by passing a positive value.</dd>
328
- </dl>
329
-
330
- <h4>Returns</h4>
331
-
332
- <p>A new image</p>
333
-
334
- <h4>See also</h4>
335
-
336
- <p><a href="image2.html#matte_replace">matte_replace</a>,
337
- <a href="draw.html#matte">Draw#matte</a>, <a href=
338
- "#transparent">transparent</a></p>
339
-
340
- <h4>Magick API</h4>
341
-
342
- <p>TransparentPaintImage</p>
343
- </div>
344
-
345
- <div class="sig">
346
- <h3 id="pixel_color">pixel_color</h3>
347
-
348
- <p><span class="arg">img</span>.pixel_color(<span class=
349
- "arg">x</span>, <span class="arg">y</span>[, <span class=
350
- "arg">new_color</span>]) -&gt; <em>pixel</em></p>
351
- </div>
352
-
353
- <div class="desc">
354
- <h4>Description</h4>
355
-
356
- <p>Returns the color of the pixel at <span class=
357
- "arg">x</span>, <span class="arg">y</span>. Optionally, changes
358
- the color of the pixel to a new color.</p>
359
-
360
- <p>If new_color is specified, pixel_color changes the image
361
- type to DirectClass if necessary.</p>
362
-
363
- <h4>Arguments</h4>
364
-
365
- <dl>
366
- <dt>x, y</dt>
367
-
368
- <dd>The x- and y-coordinates of the pixel.</dd>
369
-
370
- <dt>new_color</dt>
371
-
372
- <dd>If specified, the pixel is set to this color. May be
373
- either a <a href="imusage.html#color_names">color name</a> or
374
- a <a href="struct.html#Pixel">Pixel</a>.</dd>
375
- </dl>
376
-
377
- <h4>Returns</h4>A <a href="struct.html#Pixel">Pixel</a> having
378
- the RGB values of the specified pixel.
379
-
380
- <h4>Example</h4>
381
- <pre>
382
- old = image.pixel_color(20,40,"white")
383
- </pre>
384
-
385
- <h4>Magick API</h4>
386
-
387
- <p>AcquireImagePixels</p>
388
- </div>
389
-
390
- <div class="sig">
391
- <h3 id="polaroid">polaroid</h3>
392
-
393
- <p><span class="arg">img</span>.polaroid(angle=-5.0) [
394
- <span class="arg">{ optional arguments }</span> ] -&gt;
395
- image</p>
396
- </div>
397
-
398
- <div class="desc">
399
- <h4>Description</h4>
400
-
401
- <p>Produce an image that looks like a Polaroid&reg; instant
402
- picture. If the image has a "Caption" <a href=
403
- "image1.html#aset">property</a>, the value is used as a
404
- caption.</p>
405
-
406
- <p>Optional arguments may be specified in a block associated
407
- with the method. These arguments control the shadow color and
408
- how the label is rendered. By default the shadow color is
409
- gray75. To specify a different shadow color, use
410
- <code>self.shadow_color</code>. To specify a different border
411
- color (that is, the color of the image border) use
412
- <code>self.border_color</code>. Both of these methods accept
413
- either a <a href="imusage.html#color_names">color name</a> or a
414
- <a href="struct.html#Pixel">Pixel</a> argument.</p>
415
-
416
- <p>The following <a href="draw.html#annotate">annotate</a>
417
- attributes control the label rendering: <a href=
418
- "draw.html#align_eq">align</a>, <a href=
419
- "draw.html#decorate_eq">decorate</a>, <a href=
420
- "draw.html#density_eq">density</a>, <a href=
421
- "draw.html#encoding_eq">encoding</a>, <a href=
422
- "draw.html#fill_eq">fill</a>, <a href=
423
- "draw.html#font_eq">font</a>, <a href=
424
- "draw.html#font_family_eq">font_family</a>, <a href=
425
- "draw.html#font_stretch_eq">font_stretch</a>, <a href=
426
- "draw.html#font_style_eq">font_style</a>, <a href=
427
- "draw.html#font_weight_eq">font_weight</a>, <a href=
428
- "draw.html#gravity_eq">gravity</a>, <a href=
429
- "draw.html#pointsize_eq">pointsize</a>, <a href=
430
- "draw.html#stroke_eq">stroke</a>, <a href=
431
- "draw.html#stroke_width_eq">stroke_width</a>, <a href=
432
- "draw.html#text_antialias_eq">text_antialias</a>, <a href=
433
- "draw.html#undercolor_eq">undercolor</a>.</p>
434
- <pre>
435
- img.polaroid do
436
- self.shadow_color = "gray40"
437
- self.pointsize = 12
438
- end
439
- </pre>
440
-
441
- <h4>Arguments</h4>
442
-
443
- <dl>
444
- <dt>angle</dt>
445
-
446
- <dd>The resulting image is rotated by this amount, measured
447
- in degrees. The default is -5.0.</dd>
448
- </dl>
449
-
450
- <h4>Example</h4>
451
-
452
- <p><a href="javascript:popup('polaroid.rb.html')"><img src=
453
- "ex/polaroid.jpg" alt="polaroid example" /></a></p>
454
-
455
- <h4>Magick API</h4>
456
-
457
- <p>PolaroidImage</p>
458
-
459
- <h4>See also</h4>
460
-
461
- <p><a href=
462
- "http://rmagick.rubyforge.org/Polaroid/polaroid.html">The
463
- Polaroid Effect</a></p>
464
-
465
- <h4>Notes</h4>
466
-
467
- <p>"Polaroid" and the other names of products of Polaroid
468
- Corporation are trademarks of Polaroid Corporation.</p>
469
- </div>
470
-
471
- <div class="sig">
472
- <h3 id="posterize">posterize</h3>
473
-
474
- <p><span class="arg">img</span>.posterize(<span class=
475
- "arg">levels</span>=4, <span class="arg">dither</span>=false)
476
- -&gt; <em>image</em></p>
477
- </div>
478
-
479
- <div class="desc">
480
- <h4>Description</h4>
481
-
482
- <p class="imquote">Reduces the image to a limited number of
483
- colors for a "poster" effect.</p>
484
-
485
- <h4>Arguments</h4>
486
-
487
- <dl>
488
- <dt>levels</dt>
489
-
490
- <dd><span class="imquote">Number of color levels allowed in
491
- each channel. Very low values (2, 3, or 4) have the most
492
- visible effect.</span> The default is 4.</dd>
493
-
494
- <dt>dither</dt>
495
-
496
- <dd>If true, dither the image. The default is false.</dd>
497
- </dl>
498
-
499
- <h4>Returns</h4>
500
-
501
- <p>A new image</p>
502
-
503
- <h4>Example</h4>
504
-
505
- <p class="rollover"><a href=
506
- "javascript:popup('posterize.rb.html')"><img src=
507
- "ex/posterize.jpg" alt="posterize example" onmouseover=
508
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
509
- "this.src='ex/posterize.jpg'" title=
510
- "Click to see the example script" /></a> <img src=
511
- "ex/images/spin.gif" alt="" class="spin" title=
512
- "Mouse over the example to see the original image" /></p>
513
-
514
- <h4>See also</h4>
515
-
516
- <p><a href="image2.html#ordered_dither">ordered_dither</a>,
517
- <a href="image3.html#quantize">quantize</a></p>
518
-
519
- <h4>Magick API</h4>
520
-
521
- <p>PosterizeImage</p>
522
- </div>
523
-
524
- <div class="sig">
525
- <h3 id="preview">preview</h3>
526
-
527
- <p><span class="arg">img</span>.preview(<span class=
528
- "arg">preview</span>) -&gt; <em>image</em></p>
529
- </div>
530
-
531
- <div class="desc">
532
- <h4>Description</h4>
533
-
534
- <p>Creates an image that contains 9 small versions of the
535
- receiver image. The center image is the unchanged receiver. The
536
- other 8 images are variations created by transforming the
537
- receiver according to the specified preview type with varying
538
- parameters.</p>
539
-
540
- <p>A preview image is an easy way to "try out" a transformation
541
- method.</p>
542
-
543
- <h4>Arguments</h4>
544
-
545
- <p>One of the following PreviewType constants:</p>
546
-
547
- <div id="prevlist">
548
- <ul>
549
- <li>RotatePreview</li>
550
-
551
- <li>ShearPreview</li>
552
-
553
- <li>RollPreview</li>
554
-
555
- <li>HuePreview</li>
556
-
557
- <li>SaturationPreview</li>
558
-
559
- <li>BrightnessPreview</li>
560
-
561
- <li>GammaPreview</li>
562
-
563
- <li>SpiffPreview</li>
564
-
565
- <li>DullPreview</li>
566
-
567
- <li>GrayscalePreview</li>
568
-
569
- <li>QuantizePreview</li>
570
-
571
- <li>DespecklePreview</li>
572
-
573
- <li>ReduceNoisePreview</li>
574
-
575
- <li>AddNoisePreview</li>
576
-
577
- <li>SharpenPreview</li>
578
- </ul>
579
-
580
- <ul>
581
- <li>BlurPreview</li>
582
-
583
- <li>ThresholdPreview</li>
584
-
585
- <li>EdgeDetectPreview</li>
586
-
587
- <li>SpreadPreview</li>
588
-
589
- <li>SolarizePreview</li>
590
-
591
- <li>ShadePreview</li>
592
-
593
- <li>RaisePreview</li>
594
-
595
- <li>SegmentPreview</li>
596
-
597
- <li>SwirlPreview</li>
598
-
599
- <li>ImplodePreview</li>
600
-
601
- <li>WavePreview</li>
602
-
603
- <li>OilPaintPreview</li>
604
-
605
- <li>CharcoalDrawingPreview</li>
606
-
607
- <li>JPEGPreview</li>
608
- </ul>
609
- </div>
610
-
611
- <div style="clear:both"></div>
612
-
613
- <h4>Returns</h4>
614
-
615
- <p>A new image</p>
616
-
617
- <h4>Example</h4>
618
-
619
- <p>This half-size preview demonstrates the SolarizePreview
620
- argument.</p>
621
-
622
- <p><a href="javascript:popup('preview.rb.html')"><img src=
623
- "ex/preview.jpg" alt="preview example" title=
624
- "Click to see the example script" /></a></p>
625
-
626
- <h4>Magick API</h4>
627
-
628
- <p>PreviewImage</p>
629
- </div>
630
-
631
- <div class="sig">
632
- <h3 id="profile_bang">profile!</h3>
633
-
634
- <p><span class="arg">img</span>.profile!(<span class=
635
- "arg">name</span>, <span class="arg">profile</span>) -&gt;
636
- <em>self</em></p>
637
- </div>
638
-
639
- <div class="desc">
640
- <h4>Description</h4>
641
-
642
- <p><span class="imquote">Adds or removes a ICM, IPTC, or
643
- generic profile from an image.</span> If <code>profile</code>
644
- is <code>nil</code>, the specified profile is removed from the
645
- image. Use <code>profile('*', nil)</code> to remove all
646
- profiles from the image.</p>
647
-
648
- <h4>Arguments</h4>
649
-
650
- <dl>
651
- <dt>name</dt>
652
-
653
- <dd>The profile name, or "*" to represent all the profiles in
654
- the image.</dd>
655
-
656
- <dt>profile</dt>
657
-
658
- <dd>The profile value, or <code>nil</code> to cause the
659
- profile to be removed.</dd>
660
- </dl>
661
-
662
- <h4>Returns</h4>
663
-
664
- <p>self</p>
665
-
666
- <h4>See also</h4>
667
-
668
- <p><a href="image1.html#add_profile">add_profile</a> and
669
- <a href="image1.html#delete_profile">delete_profile</a> perform
670
- very similar functions. However, <code>add_profile</code>
671
- accepts the name of a profile file on disk instead of the
672
- profile data itself and, if the file contains more than one
673
- profile, will load all the profiles at once.</p>
674
-
675
- <h4>Magick API</h4>
676
-
677
- <p>ProfileImage</p>
678
-
679
- <h4>Notes</h4>
680
-
681
- <p>ImageMagick does not automatically remove profiles when
682
- resizing images. If you are trying to make your JPEG thumbnail
683
- images as small as possible, use <code>profile!</code> to
684
- remove any profiles from the image as well. Also see <a href=
685
- "#strip_bang">strip!</a></p>
686
- </div>
687
-
688
- <div class="sig">
689
- <h3 id="properties">properties</h3>
690
-
691
- <p><span class="arg">img</span>.properties <span class="arg">[
692
- {|name,value| block} ]</span> -&gt; <em>hash</em></p>
693
- </div>
694
-
695
- <div class="desc">
696
- <h4>Description</h4>
697
-
698
- <p>If called with an associated block, <code>properties</code>
699
- runs the block once for each property defined for the image.
700
- The block arguments are the property name and its value. If
701
- there is no block, <code>properties</code> returns a hash with
702
- one element for each property. The hash key is the property
703
- name and the associated value is the property value.</p>
704
-
705
- <h4>Returns</h4>
706
-
707
- <p>If called without a block, returns a hash, otherwise returns
708
- <code>self</code>.</p>
709
-
710
- <h4>See also</h4>
711
-
712
- <p><a href="image1.html#aref">[&nbsp;]</a>, <a href=
713
- "image1.html#aset">[&nbsp;]=</a></p>
714
-
715
- <h4>Note</h4>
716
-
717
- <p>The EXIF property is not created until the first time an
718
- EXIF tag or entry number is referenced.</p>
719
- </div>
720
-
721
- <div class="sig">
722
- <h3 id="quantize">quantize</h3>
723
-
724
- <p><span class="arg">img</span>.quantize(<span class=
725
- "arg">number_colors</span>=256, <span class=
726
- "arg">colorspace</span>=RGBColorspace, <span class=
727
- "arg">dither</span>=<code>RiemersmaDitherMethod</code>,
728
- <span class="arg">tree_depth</span>=0, <span class=
729
- "arg">measure_error</span>=<code>false</code>) -&gt;
730
- <em>image</em></p>
731
- </div>
732
-
733
- <div class="desc">
734
- <h4>Description</h4>
735
-
736
- <p class="imquote">Analyzes the colors within a reference image
737
- and chooses a fixed number of colors to represent the image.
738
- The goal of the algorithm is to minimize the difference between
739
- the input and output image while minimizing the processing
740
- time.</p>
741
-
742
- <h4>Arguments</h4>
743
-
744
- <dl>
745
- <dt>number_colors</dt>
746
-
747
- <dd>The maximum number of colors in the result image. Must be
748
- &lt;= <a href=
749
- "constants.html#Miscellaneous_constants">QuantumRange</a>.</dd>
750
-
751
- <dt>colorspace</dt>
752
-
753
- <dd class="imquote">The <a href=
754
- "constants.html#ColorspaceType">colorspace</a> to quantize
755
- in. Color reduction, by default, takes place in the RGB color
756
- space.&nbsp; Empirical evidence&nbsp;suggests that distances
757
- in color spaces such as YUV or YIQ&nbsp; correspond&nbsp;
758
- to&nbsp; perceptual&nbsp; color differences more closely
759
- than&nbsp; do distances in RGB space. The Transparent color
760
- space behaves uniquely in that it preserves the matte channel
761
- of the image if it exists.</dd>
762
-
763
- <dt>dither</dt>
764
-
765
- <dd>A <a href="constants.html#DitherMethod">DitherMethod</a>
766
- value. Set to <code>NoDitherMethod</code> to disable
767
- dithering. See the documentation for the <a href=
768
- "http://redux.imagemagick.org/script/command-line-options.php#dither">
769
- ImageMagick -dither option</a> for more information.</dd>
770
-
771
- <dt>tree_depth</dt>
772
-
773
- <dd><span class="imquote">The tree depth to use while
774
- quantizing. The values 0 and 1 support automatic tree depth
775
- determination. The tree depth may be forced via values
776
- ranging from 2 to 8. The ideal tree depth depends on the
777
- characteristics of the input image, and may be determined
778
- through experimentation.</span> See the documentation for the
779
- <a href=
780
- "http://redux.imagemagick.org/script/command-line-options.php#treedepth">
781
- ImageMagick -treedepth option</a> for more information.</dd>
782
-
783
- <dt>measure_error</dt>
784
-
785
- <dd class="imquote">Set to <code>true</code> to calculate
786
- quantization errors when quantizing the image.</dd>
787
- </dl>
788
-
789
- <h4>Returns</h4>
790
-
791
- <p>A new image</p>
792
-
793
- <h4>Example</h4>
794
-
795
- <p>See the example for <a href=
796
- "image1.html#colorize">colorize</a>.</p>
797
-
798
- <h4>See also</h4>
799
-
800
- <p><a href="image2.html#ordered_dither">ordered_dither</a>,
801
- <a href="image3.html#posterize">posterize</a>, <a href=
802
- "ilist.html#quantize">ImageList#quantize</a></p>
803
-
804
- <h4>Magick API</h4>
805
-
806
- <p>QuantizeImage</p>
807
- </div>
808
-
809
- <div class="sig">
810
- <h3 id="quantum_operator">quantum_operator</h3>
811
-
812
- <p><span class="arg">img</span>.quantum_operator(<span class=
813
- "arg">operator</span>, <span class="arg">rvalue</span>,
814
- <span class="arg">channel</span>=AllChannels) -&gt;
815
- <em>self</em></p>
816
- </div>
817
-
818
- <div class="desc">
819
- <h4>Description</h4>
820
-
821
- <p>Performs the requested integer arithmetic operation on the
822
- selected channel of the image. This method allows simple
823
- arithmetic operations on the component values of all pixels in
824
- an image. Of course, you could also do this in Ruby using
825
- <a href="image2.html#get_pixels">get_pixels</a> and <a href=
826
- "#store_pixels">store_pixels</a>, or <a href="#view">view</a>,
827
- but <code>quantum_operator</code> will be faster, especially
828
- for large numbers of pixels, since it does not need to convert
829
- the pixels from C to Ruby.</p>
830
-
831
- <h4>Arguments</h4>
832
-
833
- <dl>
834
- <dt>operator</dt>
835
-
836
- <dd>
837
- One of the following <code>QuantumExpressionOperator</code>
838
- constants:
839
-
840
- <ul id="quantum_op_list">
841
- <li>AddQuantumOperator</li>
842
-
843
- <li><code>AndQuantumOperator</code></li>
844
-
845
- <li><code>DivideQuantumOperator</code></li>
846
-
847
- <li><code>LShiftQuantumOperator</code></li>
848
-
849
- <li><code>MaxQuantumOperator</code></li>
850
-
851
- <li><code>MinQuantumOperator</code></li>
852
-
853
- <li><code>MultiplyQuantumOperator</code></li>
854
-
855
- <li><code>OrQuantumOperator</code></li>
856
-
857
- <li><code>RShiftQuantumOperator</code></li>
858
-
859
- <li><code>SubtractQuantumOperator</code></li>
860
-
861
- <li><code>XorQuantumOperator</code></li>
862
-
863
- <li><code>PowQuantumOperator</code></li>
864
-
865
- <li><code>LogQuantumOperator</code></li>
866
-
867
- <li><code>ThresholdQuantumOperator</code></li>
868
-
869
- <li><code>ThresholdBlackQuantumOperator</code></li>
870
-
871
- <li><code>ThresholdWhiteQuantumOperator</code></li>
872
-
873
- <li><code>GaussianNoiseQuantumOperator</code></li>
874
-
875
- <li><code>ImpulseNoiseQuantumOperator</code></li>
876
-
877
- <li><code>LaplacianNoiseQuantumOperator</code></li>
878
-
879
- <li><code>MultiplicativeNoiseQuantumOperator</code></li>
880
-
881
- <li><code>PoissonNoiseQuantumOperator</code></li>
882
-
883
- <li><code>UniformNoiseQuantumOperator</code></li>
884
-
885
- <li><code>CosineQuantumOperator</code></li>
886
-
887
- <li><code>SineQuantumOperator</code></li>
888
-
889
- <li><code>AddModulusQuantumOperator</code></li>
890
- </ul>Some of these constants are not defined in older
891
- releases of ImageMagick. To see which ones are defined,
892
- enter this statement in IRB:
893
- <pre>
894
- Magick::QuantumExpressionOperator.values {|v| puts v}
895
- </pre>
896
- </dd>
897
-
898
- <dt>rvalue</dt>
899
-
900
- <dd>a <code>Numeric</code> operation rvalue.</dd>
901
-
902
- <dt>channel</dt>
903
-
904
- <dd>A <a href="constants.html#ChannelType">ChannelType</a>
905
- value. The default is to operate on the R, G. and B
906
- channels.</dd>
907
- </dl>
908
-
909
- <h4>Returns</h4>
910
-
911
- <p>self</p>
912
-
913
- <h4>Example</h4>
914
-
915
- <p>Divide the red component of all the pixels in the image by
916
- 2:</p>
917
- <pre>
918
- img.quantum_operator(DivideQuantumOperator, 2, RedChannel)
919
- </pre>
920
-
921
- <h4>See also</h4>
922
-
923
- <p><a href=
924
- "image2.html#function_channel">function_channel</a></p>
925
-
926
- <p>The <a href="struct.html#view">Image:View</a> class supports
927
- operations on individual pixels and collections of pixels, as
928
- well as operations on channels within pixels. See <a href=
929
- "#view">view</a>, below.</p>
930
-
931
- <h4>Magick API</h4>
932
-
933
- <p>EvaluateImageChannel</p>
934
- </div>
935
-
936
- <div class="sig">
937
- <h3 id="radial_blur">radial_blur</h3>
938
-
939
- <p><span class="arg">img</span>.radial_blur(<span class=
940
- "arg">float</span>) -&gt; <em>image</em></p>
941
- </div>
942
-
943
- <div class="desc">
944
- <h4>Description</h4>
945
-
946
- <p class="imquote">Applies a radial blur to the image.</p>
947
-
948
- <h4>Arguments</h4>
949
-
950
- <dl>
951
- <dt>angle</dt>
952
-
953
- <dd>Amount of blur, in degrees</dd>
954
- </dl>
955
-
956
- <h4>Returns</h4>
957
-
958
- <p>A new image</p>
959
-
960
- <h4>Example</h4>
961
-
962
- <p class="rollover"><a href=
963
- "javascript:popup('radial_blur.rb.html')"><img src=
964
- "ex/radial_blur.jpg" onmouseover=
965
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
966
- "this.src='ex/radial_blur.jpg'" alt="radial_blur example"
967
- title="Click to see the example script" /></a> <img src=
968
- "ex/images/spin.gif" alt="" class="spin" title=
969
- "Mouse over the example to see the original image" /></p>
970
-
971
- <h4>See also</h4>
972
-
973
- <p><a href="image1.html#blur_image">blur_image</a>, <a href=
974
- "image2.html#gaussian_blur">gaussian_blur</a>, <a href=
975
- "image2.html#motion_blur">motion_blur</a>, <a href=
976
- "#radial_blur_channel">radial_blur_channel</a>, <a href=
977
- "#selective_blur_channel">selective_blur_channel</a></p>
978
-
979
- <h4>Magick API</h4>
980
-
981
- <p>RadialBlurImage</p>
982
- </div>
983
-
984
- <div class="sig">
985
- <h3 id="radial_blur_channel">radial_blur_channel</h3>
986
-
987
- <p><span class=
988
- "arg">img</span>.radial_blur_channel(<span class="arg">float</span>
989
- [, <span class="arg">channel</span>...]) -&gt;
990
- <em>image</em></p>
991
- </div>
992
-
993
- <div class="desc">
994
- <h4>Description</h4>
995
-
996
- <p>Applies a radial blur to the selected image channels.</p>
997
-
998
- <h4>Arguments</h4>
999
-
1000
- <dl>
1001
- <dt>angle</dt>
1002
-
1003
- <dd>Amount of blur, in degrees</dd>
1004
-
1005
- <dt>channel...</dt>
1006
-
1007
- <dd>0 or more <a href=
1008
- "constants.html#ChannelType">ChannelType</a> arguments. If no
1009
- channels are specified, all the channels are blurred.</dd>
1010
- </dl>
1011
-
1012
- <h4>Returns</h4>
1013
-
1014
- <p>A new image</p>
1015
-
1016
- <h4>See also</h4>
1017
-
1018
- <p><a href="#radial_blur">radial_blur</a></p>
1019
-
1020
- <h4>Magick API</h4>
1021
-
1022
- <p>RadialBlurImageChannel</p>
1023
- </div>
1024
-
1025
- <div class="sig">
1026
- <h3 id="raise">raise</h3>
1027
-
1028
- <p><span class="arg">img</span>.raise(<span class=
1029
- "arg">width</span>=6, <span class="arg">height</span>=6,
1030
- <span class="arg">raised</span>=<code>true</code>) -&gt;
1031
- <em>image</em></p>
1032
- </div>
1033
-
1034
- <div class="desc">
1035
- <h4>Description</h4>
1036
-
1037
- <p class="imquote">Creates a simulated three-dimensional
1038
- button-like effect by lightening and darkening the edges of the
1039
- image.</p>
1040
-
1041
- <h4>Arguments</h4>
1042
-
1043
- <dl>
1044
- <dt>width</dt>
1045
-
1046
- <dd>The width of the raised edge in pixels. The default is
1047
- 6.</dd>
1048
-
1049
- <dt>height</dt>
1050
-
1051
- <dd>The height of the raised edge in pixels. The default is
1052
- 6.</dd>
1053
-
1054
- <dt>raised</dt>
1055
-
1056
- <dd>If <code>true</code>, the image is raised, otherwise
1057
- lowered.</dd>
1058
- </dl>
1059
-
1060
- <h4>Returns</h4>
1061
-
1062
- <p>A new image</p>
1063
-
1064
- <h4>Example</h4>
1065
-
1066
- <p class="rollover"><a href=
1067
- "javascript:popup('raise.rb.html')"><img src="ex/raise.jpg"
1068
- onmouseover="this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1069
- "this.src='ex/raise.jpg'" alt="raise example" title=
1070
- "Click to see the example script" /></a> <img src=
1071
- "ex/images/spin.gif" alt="" class="spin" title=
1072
- "Mouse over the example to see the original image" /></p>
1073
-
1074
- <h4>Magick API</h4>
1075
-
1076
- <p>RaiseImage</p>
1077
- </div>
1078
-
1079
- <div class="sig">
1080
- <h3 id="random_threshold_channel">random_threshold_channel</h3>
1081
-
1082
- <p><span class="arg">img</span>.random_threshold_channel(
1083
- <span class="arg">thresholds</span>, [<span class=
1084
- "arg">channel</span>...] ) -&gt; <em>image</em></p>
1085
- </div>
1086
-
1087
- <div class="desc">
1088
- <h4>Description</h4>
1089
-
1090
- <p class="imquote">Changes the value of individual pixels based
1091
- on the intensity of each pixel compared to a random threshold.
1092
- The result is a low-contrast, two color image.</p>
1093
-
1094
- <h4>Arguments</h4>
1095
-
1096
- <dl>
1097
- <dt>thresholds</dt>
1098
-
1099
- <dd><span class="imquote">A geometry string containing
1100
- LOWxHIGH thresholds.</span> The string is in the form `XxY'.
1101
- The Y value may be omitted, in which case it is assigned the
1102
- value QuantumRange-X. If an % appears in the string then the
1103
- values are assumed to be percentages of QuantumRange.
1104
- <span class="imquote">If the string contains 2x2, 3x3, or
1105
- 4x4, then an ordered dither of order 2, 3, or 4 will be
1106
- performed instead.</span> A <a href=
1107
- "struct.html#Geometry">Geometry</a> object may be used as
1108
- well.</dd>
1109
-
1110
- <dt>channel...</dt>
1111
-
1112
- <dd>0 or more <a href=
1113
- "constants.html#ChannelType">ChannelType</a> arguments. If no
1114
- channels are specified, all the channels are
1115
- thresholded.</dd>
1116
- </dl>
1117
-
1118
- <h4>Returns</h4>
1119
-
1120
- <p>A new image</p>
1121
-
1122
- <h4>Example</h4>
1123
- <pre>
1124
- geom = Geometry.new(QuantumRange/2)
1125
- random_threshold_channel(geom, RedChannel)
1126
- </pre>
1127
-
1128
- <p class="rollover"><a href=
1129
- "javascript:popup('random_threshold_channel.rb.html')"><img src="ex/random_threshold_channel.jpg"
1130
- alt="random_threshold_channel example" title=
1131
- "Click to see the example script" onmouseover=
1132
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1133
- "this.src='ex/random_threshold_channel.jpg'" /></a> <img src=
1134
- "ex/images/spin.gif" alt="" class="spin" title=
1135
- "Mouse over the example to see the original image" /></p>
1136
-
1137
- <h4>See also</h4>
1138
-
1139
- <p><a href=
1140
- "image1.html#adaptive_threshold">adaptive_threshold</a>,
1141
- <a href="image1.html#bilevel_channel">bilevel_channel</a>,
1142
- <a href="#threshold">threshold</a></p>
1143
-
1144
- <h4>Magick API</h4>
1145
-
1146
- <p>RandomThresholdImageChannel</p>
1147
- </div>
1148
-
1149
- <div class="sig">
1150
- <h3 id="recolor">recolor</h3>
1151
-
1152
- <p><span class="arg">img</span>.recolor(<span class=
1153
- "arg">color_matrix</span>) -&gt; <em>image</em></p>
1154
- </div>
1155
-
1156
- <div class="desc">
1157
- <h4>Description</h4>
1158
-
1159
- <p>Use this method to <span class="imquote">translate, scale,
1160
- shear, or rotate image colors. Although you can use variable
1161
- sized matrices, typically you use a 5&times;5 for an RGBA image
1162
- and a 6&times;6 for CMYKA. Populate the last row with
1163
- normalized values to translate.</span></p>
1164
-
1165
- <h4>Arguments</h4>
1166
-
1167
- <p>An array of Float values representing the recolor
1168
- matrix.</p>
1169
-
1170
- <h4>Magick API</h4>
1171
-
1172
- <p>RecolorImage</p>
1173
- </div>
1174
-
1175
- <div class="sig">
1176
- <h3 id="reduce_noise">reduce_noise</h3>
1177
-
1178
- <p><span class="arg">img</span>.reduce_noise(<span class=
1179
- "arg">radius</span>) -&gt; <em>image</em></p>
1180
- </div>
1181
-
1182
- <div class="desc">
1183
- <h4>Description</h4>
1184
-
1185
- <p class="imquote">Smooths the contours of an image while still
1186
- preserving edge information. The algorithm works by replacing
1187
- each pixel with its neighbor closest in value.</p>
1188
-
1189
- <h4>Arguments</h4>
1190
-
1191
- <dl>
1192
- <dt>radius</dt>
1193
-
1194
- <dd class="imquote">A neighbor is defined by radius. Use a
1195
- radius of 0 and <code>reduce_noise</code> selects a suitable
1196
- radius for you.</dd>
1197
- </dl>
1198
-
1199
- <h4>Returns</h4>
1200
-
1201
- <p>A new image</p>
1202
-
1203
- <h4>Example</h4>
1204
-
1205
- <p>The left side of the image has been modified by <a href=
1206
- "#Image.add_noise"><code>add_noise</code></a>. The right side
1207
- has been filtered by <code>reduce_noise(0)</code>.</p>
1208
-
1209
- <p><a href="javascript:popup('reduce_noise.rb.html')"><img src=
1210
- "ex/reduce_noise.jpg" title="Click to see the example script"
1211
- alt="reduce_noise example" /></a></p>
1212
-
1213
- <h4>See also</h4>
1214
-
1215
- <p><a href="image2.html#enhance">enhance</a>, <a href=
1216
- "#unsharp_mask">unsharp_mask</a></p>
1217
-
1218
- <h4>Magick API</h4>
1219
-
1220
- <p>ReduceNoiseImage</p>
1221
- </div>
1222
-
1223
- <div class="sig">
1224
- <h3 id="remap">remap</h3>
1225
-
1226
- <p><span class="arg">img</span>.remap(<span class=
1227
- "arg">remap_image</span>, <span class=
1228
- "arg">dither</span>=RiemersmaDitherMethod) -&gt;
1229
- <em>self</em></p>
1230
- </div>
1231
-
1232
- <div class="desc">
1233
- <h4>Description</h4>
1234
-
1235
- <p>Reduce the number of colors in <span class="arg">img</span>
1236
- to the colors used by <span class="arg">remap_image</span>. If
1237
- a dither method is specified <span class="imquote">then the
1238
- given colors are dithered over the image as necessary,
1239
- otherwise the closest color (in RGB colorspace) is selected to
1240
- replace that pixel in the image.</span></p>
1241
-
1242
- <h4>Arguments</h4>
1243
-
1244
- <dl>
1245
- <dt>remap_image</dt>
1246
-
1247
- <dd>The reference image</dd>
1248
-
1249
- <dt>dither</dt>
1250
-
1251
- <dd>A <a href="constants.html#DitherMethod">DitherMethod</a>
1252
- value. RiemersmaDitherMethod is the default. To disable
1253
- dithering specify NoDitherMethod.</dd>
1254
- </dl>
1255
-
1256
- <h4>Returns</h4>
1257
-
1258
- <p>self</p>
1259
-
1260
- <h4>Example</h4>
1261
-
1262
- <p class="rollover"><a href=
1263
- "javascript:popup('remap.rb.html')"><img onmouseover=
1264
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1265
- "this.src='ex/remap.jpg'" src="ex/remap.jpg" alt=
1266
- "remap example" title="Click to see the example script" /></a>
1267
- <img src="ex/images/spin.gif" alt="" class="spin" style=
1268
- "left: 202px;" title=
1269
- "Mouse over the example to see the original image" /></p>
1270
-
1271
- <h4>See also</h4>
1272
-
1273
- <p><a href="ilist.html#remap">ImageList#remap</a></p>
1274
-
1275
- <h4>Magick API</h4>
1276
-
1277
- <p>RemapImage (available in ImageMagick 6.4.3-6)</p>
1278
- </div>
1279
-
1280
- <div class="sig">
1281
- <h3 id="resample">resample</h3>
1282
-
1283
- <p><span class="arg">img</span>.resample(<span class=
1284
- "arg">horizontal_res</span>=72.0[, <span class=
1285
- "arg">vertical_res</span>]) -&gt; <em>image</em></p>
1286
- </div>
1287
-
1288
- <div class="desc">
1289
- <h4>Description</h4>
1290
-
1291
- <p class="imquote">Resample image to specified horizontal and
1292
- vertical resolution.</p>
1293
-
1294
- <p><span class="imquote">Resize the image so that its rendered
1295
- size remains the same as the original at the specified target
1296
- resolution. For example, if a 300 DPI image renders at 3 inches
1297
- by 2 inches on a 300 DPI device, when the image has been
1298
- resampled to 72 DPI, it will render at 3 inches by 2 inches on
1299
- a 72 DPI device. Note that only a small number of image formats
1300
- (e.g. JPEG, PNG, and TIFF) are capable of storing the image
1301
- resolution. For formats which do not support an image
1302
- resolution, the original resolution of the image must be
1303
- specified via</span> the <a href=
1304
- "imageattrs.html#density">density</a> attribute <span class=
1305
- "imquote">prior to specifying the resample
1306
- resolution.</span></p>
1307
-
1308
- <h4>Arguments</h4>
1309
-
1310
- <dl>
1311
- <dt>horizontal_res</dt>
1312
-
1313
- <dd>the target horizontal resolution. The default is
1314
- 72.0.</dd>
1315
-
1316
- <dt>vertical_res</dt>
1317
-
1318
- <dd>the target vertical resolution. The default is
1319
- <span class="arg">horizontal_res</span>.</dd>
1320
- </dl>
1321
- </div>
1322
-
1323
- <div class="sig">
1324
- <h3 id="resize">resize</h3>
1325
-
1326
- <p><span class="arg">img</span>.resize(<span class=
1327
- "arg">new_width</span>, <span class="arg">new_height</span>,
1328
- <em>filter</em>=<a href=
1329
- "constants.html#FilterTypes">LanczosFilter</a>,
1330
- <em>support</em>=1.0) -&gt; <em>image</em><br />
1331
- <span class="arg">img</span>.resize(<span class=
1332
- "arg">scale_factor</span>) -&gt; <em>image</em></p>
1333
- </div>
1334
-
1335
- <div class="desc">
1336
- <h4>Description</h4>
1337
-
1338
- <p>Changes the size of the receiver to the specified
1339
- dimensions.</p>
1340
-
1341
- <h4>Arguments</h4>
1342
-
1343
- <p>You can specify the new size in two ways. Either specify the
1344
- new width and height explicitly, or specify a <em>scale
1345
- factor</em>, a number that represents the percentage
1346
- change.</p>
1347
-
1348
- <p>Use the <a href=
1349
- "image1.html#change_geometry">change_geometry</a> method to
1350
- resize an image with constraints such as "maintain the current
1351
- proportions."</p>
1352
-
1353
- <dl>
1354
- <dt>new_width, new_height</dt>
1355
-
1356
- <dd>The desired width and height.</dd>
1357
-
1358
- <dt>filter</dt>
1359
-
1360
- <dd>The <a href="constants.html#FilterTypes">filter</a> to
1361
- use when resizing. If you do not specify a filter argument,
1362
- resize uses the value of the receiver's <a href=
1363
- "imageattrs.html#Image.filter">filter attribute</a>.
1364
- <span class="imquote">Most of the filters are FIR (finite
1365
- impulse response), however, Bessel, Gaussian, and Sinc are
1366
- IIR (infinite impulse response). Bessel and Sinc are windowed
1367
- (brought down to zero) with the Blackman filter.</span></dd>
1368
-
1369
- <dt>support</dt>
1370
-
1371
- <dd>Values &gt; 1 increase the blurriness. Values &lt; 1
1372
- increase the sharpness. If this argument is not specified,
1373
- <code>resize</code> uses the value of the receiver's <a href=
1374
- "imageattrs.html#Image.blur">blur</a> attribute.</dd>
1375
-
1376
- <dt>scale_factor</dt>
1377
-
1378
- <dd>You can use this argument instead of specifying the
1379
- desired width and height. The percentage size change. For
1380
- example, 1.25 makes the new image 125% of the size of the
1381
- receiver. The scale factor 0.5 makes the new image 50% of the
1382
- size of the receiver.</dd>
1383
- </dl>
1384
-
1385
- <h4>Returns</h4>
1386
-
1387
- <p>A new image</p>
1388
-
1389
- <h4>See also</h4>
1390
-
1391
- <p><a href="image1.html#change_geometry">change_geometry</a>,
1392
- <a href="#resize_bang">resize!</a>, <a href=
1393
- "image2.html#magnify">magnify</a>, <a href=
1394
- "image2.html#minify">minify</a>, <a href="#sample">sample</a>,
1395
- <a href="#scale">scale</a>, <a href=
1396
- "thumbnail">thumbnail</a></p>
1397
-
1398
- <h4>Magick API</h4>
1399
-
1400
- <p>ResizeImage</p>
1401
- </div>
1402
-
1403
- <div class="sig">
1404
- <h3 id="resize_bang">resize!</h3>
1405
-
1406
- <p><span class="arg">img</span>.resize!(<em>new_width</em>,
1407
- <em>new_height</em>, <em>filter</em>=<a href=
1408
- "constants.html#FilterTypes">LanczosFilter</a>,
1409
- <em>support</em>=1.0) -&gt; <em>self</em><br />
1410
- <span class="arg">img</span>.resize!(<span class=
1411
- "arg">scale_factor</span>) -&gt; <em>self</em></p>
1412
- </div>
1413
-
1414
- <div class="desc">
1415
- <h4>Description</h4>
1416
-
1417
- <p>In-place form of <a href="#resize">resize</a>.</p>
1418
-
1419
- <h4>Returns</h4>
1420
-
1421
- <p>self</p>
1422
- </div>
1423
-
1424
- <div class="sig">
1425
- <h3 id="resize_to_fill">resize_to_fill</h3>
1426
-
1427
- <p><span class="arg">img</span>.resize_to_fill(<span class=
1428
- "arg">width</span> [, <span class="arg">height</span> [,
1429
- <span class="arg">gravity</span>=<code>CenterGravity</code>]])
1430
- -&gt; <span class="arg">image</span></p>
1431
- </div>
1432
-
1433
- <div class="desc">
1434
- <h4>Description</h4>
1435
-
1436
- <p>A convenience method. Resize the image to fit within the
1437
- specified dimensions while retaining the aspect ratio of the
1438
- original image. If necessary, crop the image in the larger
1439
- dimension.</p>
1440
-
1441
- <h4>Arguments</h4>
1442
-
1443
- <dl>
1444
- <dt>width</dt>
1445
-
1446
- <dd>The width of the resulting image in pixels</dd>
1447
-
1448
- <dt>height</dt>
1449
-
1450
- <dd>(Optional) The height of the resulting image in pixels.
1451
- If omitted, defaults to <span class="arg">width</span>.</dd>
1452
-
1453
- <dt>gravity</dt>
1454
-
1455
- <dd>Use this argument to specify which portion of the image
1456
- to retain when cropping. The value can be any <a href=
1457
- "constants.html#GravityType">GravityType</a> value. The
1458
- effect is the same as the <span class="arg">gravity</span>
1459
- argument to the <a href=
1460
- "image1.html#crop"><code>crop</code></a> method. The default
1461
- is <code>CenterGravity</code>.</dd>
1462
- </dl>
1463
-
1464
- <h4>Returns</h4>
1465
-
1466
- <p>A new image</p>
1467
-
1468
- <h4>Example</h4>
1469
-
1470
- <p>In this example, some rows have been cropped from the top
1471
- and bottom to produce a square thumbnail from a rectangular
1472
- image without distorting the image.</p>
1473
-
1474
- <p class="rollover"><a href=
1475
- "javascript:popup('resize_to_fill.rb.html')">
1476
- <!-- This img tag displays the after image when the mouse is not over-->
1477
- <img src="ex/resize_to_fill.jpg" style=
1478
- "padding-left:62px; padding-right: 62px; padding-top: 87px;padding-bottom:87px;"
1479
- id="after_resize_to_fill" onmouseover=
1480
- "this.style.display='none'; before_resize_to_fill.style.display='';"
1481
- alt="resize_to_fill example" />
1482
- <!-- This img tag displays the before image when moused over -->
1483
- <img src="ex/images/Flower_Hat.jpg" style="display: none" id=
1484
- "before_resize_to_fill" onmouseout=
1485
- "this.style.display='none'; after_resize_to_fill.style.display='';"
1486
- alt="resize_to_fill example" title=
1487
- "Click to see the example script" /></a> <img src=
1488
- "ex/images/spin.gif" alt="" style="margin-bottom: 230px" title=
1489
- "Mouse over the example to see the original image" /></p>
1490
-
1491
- <h4>See also</h4>
1492
-
1493
- <p><a href="image1.html#crop">crop</a>, <a href=
1494
- "#resize">resize</a>, <a href=
1495
- "#resize_to_fit">resize_to_fit</a></p>
1496
-
1497
- <h4>Notes</h4>
1498
-
1499
- <p><code>crop_resized</code> is an alias for this method.</p>
1500
- </div>
1501
-
1502
- <div class="sig">
1503
- <h3 id="resize_to_fill_bang">resize_to_fill!</h3>
1504
-
1505
- <p><span class="arg">img</span>.resize_to_fill!(<span class=
1506
- "arg">width</span> [, <span class="arg">height</span> [,
1507
- <span class="arg">gravity</span>=<code>CenterGravity</code>]])
1508
- -&gt; <em>self</em></p>
1509
- </div>
1510
-
1511
- <div class="desc">
1512
- <h4>Description</h4>The in-place form of <a href=
1513
- "#resize_to_fill">resize_to_fill</a>.
1514
-
1515
- <h4>Returns</h4>
1516
-
1517
- <p>self</p>
1518
-
1519
- <h4>See also</h4>
1520
-
1521
- <p><a href="image1.html#crop_bang">crop!</a>, <a href=
1522
- "#resize_bang">resize!</a>, <a href=
1523
- "#resize_to_fit_bang">resize_to_fit!</a></p>
1524
-
1525
- <h4>Notes</h4>
1526
-
1527
- <p><code>crop_resized!</code> is an alias for this method.</p>
1528
- </div>
1529
-
1530
- <div class="sig">
1531
- <h3 id="resize_to_fit">resize_to_fit</h3>
1532
-
1533
- <p><span class="arg">img</span>.resize_to_fit(<span class=
1534
- "arg">new_width</span> [, <span class="arg">new_height</span>])
1535
- -&gt; <em>image</em></p>
1536
- </div>
1537
-
1538
- <div class="desc">
1539
- <h4>Description</h4>
1540
-
1541
- <p>A convenience method. Resize the image to fit within the
1542
- specified dimensions while retaining the original aspect ratio.
1543
- The image may be shorter or narrower than specified in the
1544
- smaller dimension but will not be larger than the specified
1545
- values.</p>
1546
-
1547
- <h4>Arguments</h4>
1548
-
1549
- <dl>
1550
- <dt>new_width</dt>
1551
-
1552
- <dd>The maximum width of the resized image.</dd>
1553
-
1554
- <dt>new_height</dt>
1555
-
1556
- <dd>(Optional) The maximum height of the resized image. If
1557
- omitted it defaults to the value of <span class=
1558
- "arg">new_width</span>.</dd>
1559
- </dl>
1560
-
1561
- <h4>Returns</h4>
1562
-
1563
- <p>A new image</p>
1564
-
1565
- <h4>Example</h4>
1566
-
1567
- <p>Compare the result of this example to the result of the
1568
- <a href="#resize_to_fill">resize_to_fill</a> example above.</p>
1569
-
1570
- <p class="rollover"><a href=
1571
- "javascript:popup('resize_to_fit.rb.html')">
1572
- <!-- This img tag displays the original image when the mouse is over -->
1573
- <img id="rtfless" style="display: none" onmouseout=
1574
- "this.style.display='none';rtf.style.display='';" src=
1575
- "ex/images/Flower_Hat.jpg" alt="resize_to_fit example" title=
1576
- "Click to see the example script" />
1577
- <!-- This img tag displays the framed image when the mouse is not over-->
1578
- <img style=
1579
- "padding-left:69px; padding-right: 69px; padding-top: 87px;padding-bottom:87px;"
1580
- id="rtf" onmouseover=
1581
- "this.style.display='none';rtfless.style.display='';" src=
1582
- "ex/resize_to_fit.jpg" alt="resize_to_fit example" /></a>
1583
- <img src="ex/images/spin.gif" alt="" style=
1584
- "margin-bottom: 230px" title=
1585
- "Mouse over the example to see the original image" /></p>
1586
-
1587
- <h4>See also</h4>
1588
-
1589
- <p><a href="#resize">resize</a>, <a href=
1590
- "#resize_to_fill">resize_to_fill</a></p>
1591
- </div>
1592
-
1593
- <div class="sig">
1594
- <h3 id="resize_to_fit_bang">resize_to_fit!</h3>
1595
-
1596
- <p><span class="arg">img</span>.resize_to_fit!(<span class=
1597
- "arg">new_width</span> [, <span class="arg">new_height</span>])
1598
- -&gt; <em>self</em></p>
1599
- </div>
1600
-
1601
- <div class="desc">
1602
- <h4>Description</h4>
1603
-
1604
- <p>In-place form of <a href=
1605
- "#resize_to_fit">resize_to_fit</a>.</p>
1606
-
1607
- <h4>Returns</h4>
1608
-
1609
- <p>self</p>
1610
-
1611
- <h4>See also</h4>
1612
-
1613
- <p><a href="#resize_bang">resize!</a>, <a href=
1614
- "#resize_to_fill_bang">resize_to_fill!</a></p>
1615
- </div>
1616
-
1617
- <div class="sig">
1618
- <h3 id="roll">roll</h3>
1619
-
1620
- <p><span class="arg">img</span>.roll(<span class=
1621
- "arg">x_offset</span>, <span class="arg">y_offset</span>) -&gt;
1622
- <em>image</em></p>
1623
- </div>
1624
-
1625
- <div class="desc">
1626
- <h4>Description</h4>
1627
-
1628
- <p class="imquote">Offsets an image as defined by <span class=
1629
- "arg">x_offset</span> and <span class=
1630
- "arg">y_offset</span>.</p>
1631
-
1632
- <h4>Arguments</h4>
1633
-
1634
- <dl>
1635
- <dt>x_offset</dt>
1636
-
1637
- <dd>The number of columns to offset the image.</dd>
1638
-
1639
- <dt>y_offset</dt>
1640
-
1641
- <dd>The number of rows to offset the image.</dd>
1642
- </dl>
1643
-
1644
- <h4>Returns</h4>
1645
-
1646
- <p>A new image</p>
1647
-
1648
- <h4>Example</h4>
1649
-
1650
- <p>This image has been offset 25% in both directions.</p>
1651
-
1652
- <p class="rollover"><a href=
1653
- "javascript:popup('roll.rb.html')"><img src="ex/roll.jpg"
1654
- title="Click to see the example script" alt="roll example"
1655
- onmouseover="this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1656
- "this.src='ex/roll.jpg'" /></a><img src="ex/images/spin.gif"
1657
- alt="" class="spin" title=
1658
- "Mouse over the example to see the original image" /></p>
1659
-
1660
- <h4>Magick API</h4>
1661
-
1662
- <p>RollImage</p>
1663
- </div>
1664
-
1665
- <div class="sig">
1666
- <h3 id="rotate">rotate</h3>
1667
-
1668
- <p><span class="arg">img</span>.rotate(<span class=
1669
- "arg">amount</span> [, <span class="arg">qualifier</span>])
1670
- -&gt; <em>image</em></p>
1671
- </div>
1672
-
1673
- <div class="desc">
1674
- <h4>Description</h4>
1675
-
1676
- <p>Rotate the receiver by the specified angle. Positive angles
1677
- rotate clockwise while negative angles rotate
1678
- counter-clockwise. New pixels introduced by the rotation are
1679
- the same color as the current <a href=
1680
- "imageattrs.html#background_color">background color</a>. Set
1681
- the background color to "none" to make the new pixels
1682
- transparent black.</p>
1683
-
1684
- <h4>Arguments</h4>
1685
-
1686
- <dl>
1687
- <dt>amount</dt>
1688
-
1689
- <dd>The number of degrees to rotate the image.</dd>
1690
-
1691
- <dt>qualifier</dt>
1692
-
1693
- <dd>If present, either "&gt;" or "&lt;". If "&gt;", rotates
1694
- the image only if the image's width exceeds its height. If
1695
- "&lt;" rotates the image only if its height exceeds its
1696
- width. If this argument is omitted the image is always
1697
- rotated.</dd>
1698
- </dl>
1699
-
1700
- <h4>Returns</h4>
1701
-
1702
- <p>A new image, or <code>nil</code> if the image was not
1703
- rotated because it did not meet the qualification specified by
1704
- the second argument.</p>
1705
-
1706
- <h4>Example</h4>
1707
-
1708
- <p class="rollover"><a href=
1709
- "javascript:popup('rotate_f.rb.html')"><!--
1710
- This img tag displays the original image when the mouse is over.
1711
- Use CSS to add padding around the image to make it occupy the
1712
- same space as the rotated image. --><img style="padding-top:34px;padding-bottom:34px; display:none"
1713
- id="notrotated" onmouseout=
1714
- "this.style.display='none'; rotated.style.display='';" src=
1715
- "ex/images/Flower_Hat.jpg" alt="rotate example" title=
1716
- "Click to see the example script" /><!--
1717
- This img tag displays the rotated image.
1718
- --><img class="hide"
1719
- id="rotated" onmouseover=
1720
- "this.style.display='none'; notrotated.style.display='';" src=
1721
- "ex/rotate_f.jpg" alt="rotate example" /></a> <img src=
1722
- "ex/images/spin.gif" alt="" class="spin" style="left:322px;"
1723
- title="Mouse over the example to see the original image" /></p>
1724
-
1725
- <h4>See also</h4>
1726
-
1727
- <p><a href="image1.html#affine_transform">affine_transform</a>,
1728
- <a href="#shear">shear</a></p>
1729
-
1730
- <h4>Magick API</h4>
1731
-
1732
- <p>RotateImage</p>
1733
- </div>
1734
-
1735
- <div class="sig">
1736
- <h3 id="rotate_bang">rotate!</h3>
1737
-
1738
- <p><span class="arg">img</span>.rotate!(<span class=
1739
- "arg">amount</span> [, <span class="arg">qualifier</span>])
1740
- -&gt; <em>self</em></p>
1741
- </div>
1742
-
1743
- <div class="desc">
1744
- <h4>Description</h4>
1745
-
1746
- <p>In-place form of <a href="#rotate">rotate</a>.</p>
1747
-
1748
- <h4>Returns</h4>
1749
-
1750
- <p>self, or <code>nil</code> if the image was not rotated
1751
- because it did not meet the qualification specified by the
1752
- second argument.</p>
1753
- </div>
1754
-
1755
- <div class="sig">
1756
- <h3 id="sample">sample</h3>
1757
-
1758
- <p><span class="arg">img</span>.sample(<span class=
1759
- "arg">new_width</span>, <span class="arg">new_height</span>)
1760
- -&gt; <span class="arg">image</span><br />
1761
- <span class="arg">img</span>.sample(<span class=
1762
- "arg">scale_factor</span>) -&gt; <em>image</em></p>
1763
- </div>
1764
-
1765
- <div class="desc">
1766
- <h4>Description</h4>
1767
-
1768
- <p>Scales an image to the desired dimensions with pixel
1769
- sampling. Unlike other scaling methods, this method does not
1770
- introduce any additional color into the scaled image.</p>
1771
-
1772
- <h4>Arguments</h4>
1773
-
1774
- <dl>
1775
- <dt>new_width, new_height</dt>
1776
-
1777
- <dd>The desired width and height.</dd>
1778
-
1779
- <dt>scale_factor</dt>
1780
-
1781
- <dd>You can use this argument instead of specifying the
1782
- desired width and height. The percentage size change. For
1783
- example, 1.25 makes the new image 125% of the size of the
1784
- receiver. The scale factor 0.5 makes the new image 50% of the
1785
- size of the receiver.</dd>
1786
- </dl>
1787
-
1788
- <h4>Returns</h4>
1789
-
1790
- <p>A new image</p>
1791
-
1792
- <h4>See also</h4>
1793
-
1794
- <p><a href="#sample_bang">sample!</a>, <a href=
1795
- "image2.html#magnify">magnify</a>, <a href=
1796
- "image2.html#minify">minify</a>, <a href="#resize">resize</a>,
1797
- <a href="#scale">scale</a>, <a href=
1798
- "#thumbnail">thumbnail</a></p>
1799
-
1800
- <h4>Magick API</h4>
1801
-
1802
- <p>SampleImage</p>
1803
- </div>
1804
-
1805
- <div class="sig">
1806
- <h3 id="sample_bang">sample!</h3>
1807
-
1808
- <p><span class="arg">img</span>.sample!(<span class=
1809
- "arg">new_width</span>, <span class="arg">new_height</span>)
1810
- -&gt; <em>self</em><br />
1811
- <span class="arg">img</span>.sample!(<span class=
1812
- "arg">scale_factor</span>) -&gt; <em>self</em></p>
1813
- </div>
1814
-
1815
- <div class="desc">
1816
- <h4>Description</h4>
1817
-
1818
- <p>In-place form of <a href="#sample">sample</a>.</p>
1819
-
1820
- <h4>Returns</h4>
1821
-
1822
- <p>self</p>
1823
- </div>
1824
-
1825
- <div class="sig">
1826
- <h3 id="scale">scale</h3>
1827
-
1828
- <p><span class="arg">img</span>.scale(<span class=
1829
- "arg">new_width</span>, <span class="arg">new_height</span>)
1830
- -&gt; <em>image</em><br />
1831
- <span class="arg">img</span>.scale(<span class=
1832
- "arg">scale_factor</span>) -&gt; <em>image</em></p>
1833
- </div>
1834
-
1835
- <div class="desc">
1836
- <h4>Description</h4>
1837
-
1838
- <p class="imquote">Changes the size of an image to the given
1839
- dimensions.</p>
1840
-
1841
- <h4>Arguments</h4>
1842
-
1843
- <dl>
1844
- <dt>new_width, new_height</dt>
1845
-
1846
- <dd>The desired width and height.</dd>
1847
-
1848
- <dt>scale_factor</dt>
1849
-
1850
- <dd>You can use this argument instead of specifying the
1851
- desired width and height. The percentage size change. For
1852
- example, 1.25 makes the new image 125% of the size of the
1853
- receiver. The scale factor 0.5 makes the new image 50% of the
1854
- size of the receiver.</dd>
1855
- </dl>
1856
-
1857
- <h4>Returns</h4>
1858
-
1859
- <p>A new image</p>
1860
-
1861
- <h4>See also</h4>
1862
-
1863
- <p><a href="#scale_bang">scale!</a>, <a href=
1864
- "image2.html#magnify">magnify</a>, <a href=
1865
- "image2.html#minify">minify</a>, <a href="#resize">resize</a>,
1866
- <a href="#sample">sample</a>, <a href=
1867
- "#thumbnail">thumbnail</a></p>
1868
-
1869
- <h4>Magick API</h4>
1870
-
1871
- <p>ScaleImage</p>
1872
- </div>
1873
-
1874
- <div class="sig">
1875
- <h3 id="scale_bang">scale!</h3>
1876
-
1877
- <p><span class="arg">img</span>.scale!(<span class=
1878
- "arg">new_width</span>, <span class="arg">new_height</span>)
1879
- -&gt; <em>self</em><br />
1880
- <span class="arg">img</span>.scale!(<span class=
1881
- "arg">scale_factor</span>) -&gt; <em>self</em></p>
1882
- </div>
1883
-
1884
- <div class="desc">
1885
- <h4>Description</h4>
1886
-
1887
- <p>In-place form of <a href="#scale">scale</a>.</p>
1888
-
1889
- <h4>Returns</h4>
1890
-
1891
- <p>self</p>
1892
- </div>
1893
-
1894
- <div class="sig">
1895
- <h3 id="segment">segment</h3>
1896
-
1897
- <p><span class="arg">img</span>.segment(<span class=
1898
- "arg">colorspace</span>=RGBColorspace, <span class=
1899
- "arg">cluster_threshold</span>=1.0, <span class=
1900
- "arg">smoothing_threshold</span>=1.5, <span class=
1901
- "arg">verbose</span>=<code>false</code>) -&gt;
1902
- <em>image</em></p>
1903
- </div>
1904
-
1905
- <div class="desc">
1906
- <h4>Description</h4>
1907
-
1908
- <p class="imquote">Segments an image by analyzing the
1909
- histograms of the color components and identifying units that
1910
- are homogeneous with the fuzzy c-means technique.</p>
1911
-
1912
- <h4>Arguments</h4>
1913
-
1914
- <dl>
1915
- <dt>colorspace</dt>
1916
-
1917
- <dd>A <a href=
1918
- "constants.html#ColorspaceType"><code>ColorspaceType</code></a>
1919
- value. <span class="imquote">Empirical evidence suggests that
1920
- distances in YUV or YIQ correspond to perceptual color
1921
- differences more closely than do distances in RGB space. The
1922
- image is then returned to RGB colorspace after color
1923
- reduction.</span></dd>
1924
-
1925
- <dt>cluster_threshold</dt>
1926
-
1927
- <dd class="imquote">The number of pixels in each cluster must
1928
- exceed the the cluster threshold to be considered valid.</dd>
1929
-
1930
- <dt>smoothing_threshold</dt>
1931
-
1932
- <dd>The <span class="imquote">smoothing threshold eliminates
1933
- noise in the second derivative of the histogram. As the value
1934
- is increased, you can expect a smoother second
1935
- derivative.</span></dd>
1936
-
1937
- <dt>verbose</dt>
1938
-
1939
- <dd>If <code>true</code>, <code>segment</code> prints
1940
- detailed information about the identified classes.</dd>
1941
- </dl>
1942
-
1943
- <h4>Returns</h4>
1944
-
1945
- <p>A new image</p>
1946
-
1947
- <h4>Example</h4>
1948
-
1949
- <p><code>segment(YUVColorspace, 0.4, 0.4)</code></p>
1950
-
1951
- <p class="rollover"><a href=
1952
- "javascript:popup('segment.rb.html')"><img src="ex/segment.jpg"
1953
- alt="segment example" title="Click to see the example script"
1954
- onmouseover="this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1955
- "this.src='ex/segment.jpg'" /></a> <img src=
1956
- "ex/images/spin.gif" alt="" class="spin" title=
1957
- "Mouse over the example to see the original image" /></p>
1958
-
1959
- <h4>Magick API</h4>
1960
-
1961
- <p>SegmentImage</p>
1962
- </div>
1963
-
1964
- <div class="sig">
1965
- <h3 id="selective_blur_channel">selective_blur_channel</h3>
1966
-
1967
- <p><span class=
1968
- "arg">img</span>.selective_blur_channel(<span class=
1969
- "arg">radius</span>, <span class="arg">sigma</span>,
1970
- <span class="arg">threshold</span>[, <span class=
1971
- "arg">channel</span>...]) -&gt; <em>image</em></p>
1972
- </div>
1973
-
1974
- <div class="desc">
1975
- <h4>Description</h4>
1976
-
1977
- <p class="imquote">Selectively blur pixels within a contrast
1978
- threshold.</p>
1979
-
1980
- <h4>Arguments</h4>
1981
-
1982
- <dl>
1983
- <dt>radius, sigma</dt>
1984
-
1985
- <dd class="imquote">Use a Gaussian operator of the given
1986
- radius and standard deviation (sigma).</dd>
1987
-
1988
- <dt>threshold</dt>
1989
-
1990
- <dd>Threshold level represented as a percentage of the
1991
- quantum range. Either a floating-point number or a string in
1992
- the form "NN%".</dd>
1993
-
1994
- <dt>channel...</dt>
1995
-
1996
- <dd>The channels to blur. 0 or more <a href=
1997
- "constants.html#ChannelType">ChannelType</a> arguments. If no
1998
- channels are specified, the default is the red, green, and
1999
- blue channels.</dd>
2000
- </dl>
2001
-
2002
- <h4>Returns</h4>
2003
-
2004
- <p>A new image</p>
2005
-
2006
- <h4>Example</h4>
2007
- <pre>
2008
- img2 = img.selective_blur_channel(0, 1, '10%')
2009
- </pre>
2010
-
2011
- <h4>See also</h4>
2012
-
2013
- <p><a href="image1.html#blur_channel">blur_channel</a>,
2014
- <a href="image1.html#blur_image">blur_image</a>, <a href=
2015
- "image2.html#gaussian_blur_channel">gaussian_blur_channel</a>,
2016
- <a href="image2.html#motion_blur">motion_blur</a>, <a href=
2017
- "#radial_blur">radial_blur</a></p>
2018
-
2019
- <h4>Magick API</h4>
2020
-
2021
- <p>SelectiveBlurImageChannel (available in ImageMagick
2022
- 6.5.0-3)</p>
2023
- </div>
2024
-
2025
- <div class="sig">
2026
- <h3 id="separate">separate</h3>
2027
-
2028
- <p>Image.separate(<span class="arg">channel</span>...) -&gt;
2029
- <em>imagelist</em></p>
2030
- </div>
2031
-
2032
- <div class="desc">
2033
- <h4>Description</h4>
2034
-
2035
- <p>Constructs a grayscale image for each channel specified.</p>
2036
-
2037
- <h4>Arguments</h4>
2038
-
2039
- <p>0 or more <a href=
2040
- "constants.html#ChannelType">ChannelType</a> arguments. If no
2041
- channels are specified, constructs an image for each of the
2042
- red, green, and blue channels.</p>
2043
-
2044
- <h4>Returns</h4>
2045
-
2046
- <p>A new imagelist containing the new images.</p>
2047
-
2048
- <h4>See also</h4>
2049
-
2050
- <p><a href="image1.html#channel">channel</a></p>
2051
-
2052
- <h4>Notes</h4>
2053
-
2054
- <p>If the image does not have an opacity channel an
2055
- OpacityChannel argument is ignored.</p>
2056
-
2057
- <h4>Magick API</h4>
2058
-
2059
- <p>SeparateImages</p>
2060
- </div>
2061
-
2062
- <div class="sig">
2063
- <h3 id="sepiatone">sepiatone</h3>
2064
-
2065
- <p><span class="arg">img</span>.sepiatone(<span class=
2066
- "arg">threshold</span>=QuantumRange) -&gt; <span class=
2067
- "arg">image</span></p>
2068
- </div>
2069
-
2070
- <div class="desc">
2071
- <h4>Description</h4>
2072
-
2073
- <p class="imquote">Applies a special effect to the image,
2074
- similar to the effect achieved in a photo darkroom by sepia
2075
- toning.</p>
2076
-
2077
- <h4>Arguments</h4>
2078
-
2079
- <dl>
2080
- <dt>threshold</dt>
2081
-
2082
- <dd class="imquote"><span class="arg">Threshold</span> ranges
2083
- from 0 to QuantumRange and is a measure of the extent of the
2084
- sepia toning. A threshold of 80% is a good starting point for
2085
- a reasonable tone. The default is QuantumRange.</dd>
2086
- </dl>
2087
-
2088
- <h4>Returns</h4>
2089
-
2090
- <p>A new image.</p>
2091
-
2092
- <h4>Example</h4>
2093
-
2094
- <p class="rollover"><a href=
2095
- "javascript:popup('sepiatone.rb.html')"><img src=
2096
- "ex/sepiatone.jpg" alt="sepiatone example" onmouseover=
2097
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
2098
- "this.src='ex/sepiatone.jpg'" title=
2099
- "Click to see the example script" /></a> <img src=
2100
- "ex/images/spin.gif" alt="" class="spin" title=
2101
- "Mouse over the example to see the original image" /></p>
2102
-
2103
- <h4>See also</h4>
2104
-
2105
- <p>You can get more control by using <a href=
2106
- "image1.html#colorize">colorize</a>.</p>
2107
-
2108
- <h4>Magick API</h4>
2109
-
2110
- <p>SepiaToneImage</p>
2111
- </div>
2112
-
2113
- <div class="sig">
2114
- <h3 id="set_channel_depth">set_channel_depth</h3>
2115
-
2116
- <p><span class="arg">img.</span>set_channel_depth(<span class=
2117
- "arg">channel</span>, <span class="arg">depth</span>) -&gt;
2118
- <em>self</em></p>
2119
- </div>
2120
-
2121
- <div class="desc">
2122
- <h4>Description</h4>
2123
-
2124
- <p>Sets the depth of the image channel.</p>
2125
-
2126
- <h4>Arguments</h4>
2127
-
2128
- <dl>
2129
- <dt>channel</dt>
2130
-
2131
- <dd>A <a href="constants.html#ChannelType">ChannelType</a>
2132
- value</dd>
2133
-
2134
- <dt>depth</dt>
2135
-
2136
- <dd>The desired depth (must be no greater than <a href=
2137
- "constants.html">QuantumDepth</a>)</dd>
2138
- </dl>
2139
-
2140
- <h4>Returns</h4>
2141
-
2142
- <p>self</p>
2143
-
2144
- <h4>See also</h4>
2145
-
2146
- <p><a href="image1.html#channel_depth">channel_depth</a></p>
2147
-
2148
- <h4>Magick API</h4>
2149
-
2150
- <p>SetImageChannelDepth</p>
2151
- </div>
2152
-
2153
- <div class="sig">
2154
- <h3 id="shade">shade</h3>
2155
-
2156
- <p><span class="arg">img</span>.shade(<span class=
2157
- "arg">shading</span>=<code>false</code>, <span class=
2158
- "arg">azimuth</span>=30, <span class="arg">elevation</span>=30)
2159
- -&gt; <em>image</em></p>
2160
- </div>
2161
-
2162
- <div class="desc">
2163
- <h4>Description</h4>
2164
-
2165
- <p class="imquote">Shines a distant light on an image to create
2166
- a three-dimensional effect. You control the positioning of the
2167
- light with <span class="arg">azimuth</span> and <span class=
2168
- "arg">elevation</span>; <span class="arg">azimuth</span> is
2169
- measured in degrees off the x axis and <span class=
2170
- "arg">elevation</span> is measured in pixels above the Z
2171
- axis.</p>
2172
-
2173
- <h4>Arguments</h4>
2174
-
2175
- <dl>
2176
- <dt>shading</dt>
2177
-
2178
- <dd>If <code>true</code>, <code>shade</code> shades the
2179
- intensity of each pixel.</dd>
2180
-
2181
- <dt>azimuth, elevation</dt>
2182
-
2183
- <dd>The light source direction. The azimuth is measured in
2184
- degrees. 0&deg; is at 9 o'clock. Increasing values move the
2185
- light source counter-clockwise.</dd>
2186
- </dl>
2187
-
2188
- <h4>Returns</h4>
2189
-
2190
- <p>A new image</p>
2191
-
2192
- <h4>Example</h4>
2193
-
2194
- <p><code>shade(true, 50, 50)</code></p>
2195
-
2196
- <p class="rollover"><a href=
2197
- "javascript:popup('shade.rb.html')"><img src="ex/shade.jpg"
2198
- alt="shade example" onmouseover=
2199
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
2200
- "this.src='ex/shade.jpg'" title=
2201
- "Click to see the example script" /></a> <img src=
2202
- "ex/images/spin.gif" alt="" class="spin" title=
2203
- "Mouse over the example to see the original image" /></p>
2204
-
2205
- <h4>Magick API</h4>
2206
-
2207
- <p>ShadeImage</p>
2208
- </div>
2209
-
2210
- <div class="sig">
2211
- <h3 id="shadow">shadow</h3>
2212
-
2213
- <p><span class="arg">img</span>.shadow(<span class=
2214
- "arg">x_offset=4</span>, <span class="arg">y_offset=4</span>,
2215
- <span class="arg">sigma=4.0</span>, <span class=
2216
- "arg">opacity=1.0</span>) -&gt; <em>image</em></p>
2217
- </div>
2218
-
2219
- <div class="desc">
2220
- <h4>Description</h4>Draws the shadow of opaque parts of the
2221
- image. This method only works when the image has opaque parts
2222
- and transparent parts. Note that the resulting image is just
2223
- the shadow. You must composite the original image over the
2224
- shadow to produce the shadowed results.
2225
-
2226
- <h4>Arguments</h4>
2227
-
2228
- <dl>
2229
- <dt>x_offset</dt>
2230
-
2231
- <dd>The shadow x-offset</dd>
2232
-
2233
- <dt>y_offset</dt>
2234
-
2235
- <dd>The shadow y-offset</dd>
2236
-
2237
- <dt>sigma</dt>
2238
-
2239
- <dd>The standard deviation of the Gaussian operator used to
2240
- produce the shadow. The higher the number, the "blurrier" the
2241
- shadow, but the longer it takes to produce the shadow. Must
2242
- be &gt; 0.0.</dd>
2243
-
2244
- <dt>opacity</dt>
2245
-
2246
- <dd>The percent opacity of the shadow. May be either a number
2247
- between 0.1 and 1.0, or a string in the form "NN%" between
2248
- "1%" and "100%". If the percentage is greater than 100 it is
2249
- reduced to 100.</dd>
2250
- </dl>
2251
-
2252
- <h4>Returns</h4>
2253
-
2254
- <p>A new image</p>
2255
-
2256
- <h4>Example</h4>
2257
-
2258
- <p class="rollover"><a href=
2259
- "javascript:popup('shadow.rb.html')">
2260
- <!-- This img tag displays the original image when the mouse is over -->
2261
- <img style="padding:8px; display:none" id="shadowless"
2262
- onmouseout=
2263
- "this.style.display='none';shadowed.style.display='';" src=
2264
- "ex/shadow_before.gif" alt="shadow example" title=
2265
- "Click to see the example script" /><!--
2266
- This img tag displays the shadowed image when the mouse is not over
2267
- --><img class="hide"
2268
- id="shadowed" onmouseover=
2269
- "this.style.display='none';shadowless.style.display='';" src=
2270
- "ex/shadow_after.gif" alt="shadow example" /></a> <img src=
2271
- "ex/images/spin.gif" alt="" style="margin-bottom: 120px" title=
2272
- "Mouse over the example to see the original image" /></p>
2273
-
2274
- <h4>Magick API</h4>
2275
-
2276
- <p>ShadowImage</p>
2277
-
2278
- <h4>Notes</h4>
2279
-
2280
- <p>The shadow image is 2&times;<span class="arg">sigma</span>
2281
- pixels larger on a side than the original image, as can be seen
2282
- in the example above.</p>
2283
- </div>
2284
-
2285
- <div class="sig">
2286
- <h3 id="sharpen">sharpen</h3>
2287
-
2288
- <p><span class="arg">img</span>.sharpen(<span class=
2289
- "arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0)
2290
- -&gt; <em>image</em></p>
2291
- </div>
2292
-
2293
- <div class="desc">
2294
- <h4>Description</h4>
2295
-
2296
- <p class="imquote">Sharpens an image. We convolve the image
2297
- with a Gaussian operator of the given <span class=
2298
- "arg">radius</span> and standard deviation (<span class=
2299
- "arg">sigma</span>). For reasonable results, <span class=
2300
- "arg">radius</span> should be larger than <span class=
2301
- "arg">sigma</span>. Use a radius of 0 and <code>sharpen</code>
2302
- selects a suitable radius for you.</p>
2303
-
2304
- <h4>Arguments</h4>
2305
-
2306
- <p>The radius and standard deviation of the Gaussian
2307
- operator.</p>
2308
-
2309
- <h4>Returns</h4>
2310
-
2311
- <p>A new image</p>
2312
-
2313
- <h4>Magick API</h4>
2314
-
2315
- <p>SharpenImage</p>
2316
-
2317
- <h4>See also</h4>
2318
-
2319
- <p><a href=
2320
- "imageattrs.html#virtual_pixel_method">virtual_pixel_method</a></p>
2321
- </div>
2322
-
2323
- <div class="sig">
2324
- <h3 id="sharpen_channel">sharpen_channel</h3>
2325
-
2326
- <p><span class="arg">img</span>.sharpen_channel( <span class=
2327
- "arg">radius</span>, <span class="arg">sigma</span>
2328
- [,<span class="arg">channel</span>...] ) -&gt;
2329
- <em>image</em></p>
2330
- </div>
2331
-
2332
- <div class="desc">
2333
- <h4>Description</h4>
2334
-
2335
- <p class="imquote">Sharpens one or more image channels. We
2336
- convolve the image with a Gaussian operator of the given radius
2337
- and standard deviation (<span class="arg">sigma</span>) . For
2338
- reasonable results, <span class="arg">radius</span> should be
2339
- larger than <span class="arg">sigma</span>. Use a radius of 0
2340
- and <code>sharpen_channel</code> selects a suitable radius for
2341
- you.</p>
2342
-
2343
- <h4>Arguments</h4>
2344
-
2345
- <dl>
2346
- <dt>radius, sigma</dt>
2347
-
2348
- <dd>The radius and standard deviation of the Gaussian
2349
- operator.</dd>
2350
-
2351
- <dt>channel...</dt>
2352
-
2353
- <dd>0 or more <a href=
2354
- "constants.html#ChannelType">ChannelType</a> arguments. If no
2355
- channels are specified, all the channels are sharpened.</dd>
2356
- </dl>
2357
-
2358
- <h4>Returns</h4>
2359
-
2360
- <p>A new image</p>
2361
-
2362
- <h4>See also</h4>
2363
-
2364
- <p><a href="#sharpen">sharpen</a></p>
2365
-
2366
- <h4>Magick API</h4>
2367
-
2368
- <p>SharpenImageChannel</p>
2369
- </div>
2370
-
2371
- <div class="sig">
2372
- <h3 id="shave">shave</h3>
2373
-
2374
- <p><span class="arg">img</span>.shave(<span class=
2375
- "arg">width</span>, <span class="arg">height</span>) -&gt;
2376
- <em>image</em></p>
2377
- </div>
2378
-
2379
- <div class="desc">
2380
- <h4>Description</h4>
2381
-
2382
- <p>Removes pixels from the edges of the image, leaving the
2383
- center rectangle.</p>
2384
-
2385
- <h4>Arguments</h4>
2386
-
2387
- <dl>
2388
- <dt>width</dt>
2389
-
2390
- <dd>The number of pixels to remove from each side of the
2391
- receiver, not to exceed half the original width.</dd>
2392
-
2393
- <dt>height</dt>
2394
-
2395
- <dd>The number of pixels to remove from the top and bottom of
2396
- the receiver, not to exceed half the original height.</dd>
2397
- </dl>
2398
-
2399
- <h4>Returns</h4>
2400
-
2401
- <p>A new image</p>
2402
-
2403
- <h4>Example</h4>
2404
-
2405
- <p class="rollover"><a href=
2406
- "javascript:popup('shave.rb.html')"><img src="ex/shave.jpg"
2407
- onmouseover="this.src='ex/images/Flower_Hat.jpg'" onmouseout=
2408
- "this.src='ex/shave.jpg'" alt="shave example" title=
2409
- "Click to see the example script" /></a> <img src=
2410
- "ex/images/spin.gif" alt="" class="spin" title=
2411
- "Mouse over the example to see the original image" /></p>
2412
-
2413
- <h4>See also</h4>
2414
-
2415
- <p><a href="#shave_bang">shave!</a>, <a href=
2416
- "image1.html#crop">crop</a></p>
2417
-
2418
- <h4>Magick API</h4>
2419
-
2420
- <p>ShaveImage</p>
2421
- </div>
2422
-
2423
- <div class="sig">
2424
- <h3 id="shave_bang">shave!</h3>
2425
-
2426
- <p><span class="arg">img</span>.shave!(<span class=
2427
- "arg">width</span>, <span class="arg">height</span>) -&gt;
2428
- <em>self</em></p>
2429
- </div>
2430
-
2431
- <div class="desc">
2432
- <h4>Description</h4>
2433
-
2434
- <p>In-place form of <a href="#shave">shave</a>.</p>
2435
-
2436
- <h4>Returns</h4>
2437
-
2438
- <p>self</p>
2439
- </div>
2440
-
2441
- <div class="sig">
2442
- <h3 id="shear">shear</h3>
2443
-
2444
- <p><span class="arg">img</span>.shear(<span class=
2445
- "arg">x_shear</span>, <span class="arg">y_shear</span>) -&gt;
2446
- <em>image</em></p>
2447
- </div>
2448
-
2449
- <div class="desc">
2450
- <h4>Description</h4>
2451
-
2452
- <p class="imquote">Shearing slides one edge of an image along
2453
- the X or Y axis, creating a parallelogram. An X direction shear
2454
- slides an edge along the X axis, while a Y direction shear
2455
- slides an edge along the Y axis. The amount of the shear is
2456
- controlled by a shear angle. For X direction shears,
2457
- <span class="arg">x_shear</span> is measured relative to the Y
2458
- axis, and similarly, for Y direction shears <span class=
2459
- "arg">y_shear</span> is measured relative to the X axis. Empty
2460
- triangles left over from shearing the image are filled with the
2461
- background color.</p>
2462
-
2463
- <h4>Arguments</h4>
2464
-
2465
- <p>The X and Y shear angles, measured in degrees. These values
2466
- must not be 180.0. If either value is 0, no shearing will
2467
- occur.</p>
2468
-
2469
- <h4>Returns</h4>
2470
-
2471
- <p>A new image</p>
2472
-
2473
- <h4>Example</h4>
2474
-
2475
- <p class="rollover"><a href=
2476
- "javascript:popup('shear.rb.html')"><!--
2477
- This img tag displays the original image when the mouse is over
2478
- --><img style="padding-top:34px; padding-bottom:33px; padding-left:49px; padding-right:49px; display:none"
2479
- id="noshear" onmouseout=
2480
- "this.style.display='none'; sheared.style.display='';" src=
2481
- "ex/images/Flower_Hat.jpg" alt="shear example" title=
2482
- "Click to see the example script" /> <!--
2483
- This img tag displays the sheared image when the mouse is not over
2484
- -->
2485
- <img id="sheared" onmouseover=
2486
- "this.style.display='none'; noshear.style.display='';" src=
2487
- "ex/shear.jpg" alt="shear example" /></a><img src=
2488
- "ex/images/spin.gif" alt="" class="spin" style=
2489
- "left: 253px; top: 34px" title=
2490
- "Mouse over the example to see the original image" /></p>
2491
-
2492
- <h4>See also</h4>
2493
-
2494
- <p><a href="image1.html#affine_transform">affine_transform</a>,
2495
- <a href="#rotate">rotate</a></p>
2496
-
2497
- <h4>Magick API</h4>
2498
-
2499
- <p>ShearImage</p>
2500
- </div>
2501
-
2502
- <div class="sig">
2503
- <h3 id="sigmoidal_contrast_channel">
2504
- sigmoidal_contrast_channel</h3>
2505
-
2506
- <p><br />
2507
- <span class=
2508
- "arg">img</span>.sigmoidal_contrast_channel(<span class=
2509
- "arg">contrast</span>=3.0, <span class=
2510
- "arg">midpoint</span>=50.0, <span class=
2511
- "arg">sharpen</span>=false[,<span class=
2512
- "arg">channel</span>...]) -&gt; <em>image</em></p>
2513
- </div>
2514
-
2515
- <div class="desc">
2516
- <h4>Description</h4>
2517
-
2518
- <p class="imquote">Adjusts the contrast of an image channel
2519
- with a non-linear sigmoidal contrast algorithm. Increases the
2520
- contrast of the image using a sigmoidal transfer function
2521
- without saturating highlights or shadows.</p>
2522
-
2523
- <h4>Arguments</h4>
2524
-
2525
- <dl>
2526
- <dt>contrast</dt>
2527
-
2528
- <dd class="imquote">indicates how much to increase the
2529
- contrast (0 is none; 3 is typical; 20 is pushing it)</dd>
2530
-
2531
- <dt>midpoint</dt>
2532
-
2533
- <dd><span class="imquote">indicates where midtones fall in
2534
- the resultant image (0 is white; 50% is middle-gray; 100% is
2535
- black).</span> Note that "50%" means "50% of the quantum
2536
- range." This argument is a number between 0 and QuantumRange.
2537
- To specify "50%" use <code>QuantumRange * 0.50</code>.</dd>
2538
-
2539
- <dt>sharpen</dt>
2540
-
2541
- <dd class="imquote">Set <span class="arg">sharpen</span> to
2542
- <code>true</code> to increase the image contrast otherwise
2543
- the contrast is reduced.</dd>
2544
-
2545
- <dt>channel...</dt>
2546
-
2547
- <dd>0 or more <a href=
2548
- "constants.html#ChannelType">ChannelType</a> arguments. If no
2549
- channels are specified, all the channels are adjusted.</dd>
2550
- </dl>
2551
-
2552
- <h4>Returns</h4>
2553
-
2554
- <p>A new image</p>
2555
-
2556
- <h4>See also</h4>
2557
-
2558
- <p><a href="image1.html#contrast">contrast</a></p>
2559
-
2560
- <h4>Magick API</h4>
2561
-
2562
- <p>SigmoidalContrastImageChannel</p>
2563
- </div>
2564
-
2565
- <div class="sig">
2566
- <h3 id="signature">signature</h3>
2567
-
2568
- <p><span class="arg">img</span>.signature -&gt;
2569
- <em>string</em></p>
2570
- </div>
2571
-
2572
- <div class="desc">
2573
- <h4>Description</h4>
2574
-
2575
- <p class="imquote">Computes a message digest from an image
2576
- pixel stream with an implementation of the NIST SHA-256 Message
2577
- Digest algorithm. This signature uniquely identifies the image
2578
- and is convenient for determining if an image has been modified
2579
- or whether two images are identical.</p>
2580
-
2581
- <p>ImageMagick adds the computed signature to the image's
2582
- properties.</p>
2583
-
2584
- <h4>Returns</h4>
2585
-
2586
- <p>The signature as a 64-character string.</p>
2587
-
2588
- <h4>Example</h4>
2589
- <pre>
2590
- img = Image.read('ex/images/Flower_Hat.jpg').first &raquo;
2591
- ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b
2592
- img.properties &raquo;
2593
- {"comment"=&gt;"File written by Adobe Photoshop\250 4.0"}
2594
- img.signature &raquo;
2595
- "485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b"
2596
- img.properties &raquo;
2597
- {"signature"=&gt;"485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b",
2598
- "comment"=&gt;"File written by Adobe Photoshop\250 4.0"}
2599
- </pre>
2600
-
2601
- <h4>See also</h4>
2602
-
2603
- <p><a href="image1.html#spaceship">&lt;=&gt;</a>, <a href=
2604
- "image1.html#difference">difference</a></p>
2605
-
2606
- <h4>Magick API</h4>
2607
-
2608
- <p>SignatureImage</p>
2609
- </div>
2610
-
2611
- <div class="sig">
2612
- <h3 id="sketch">sketch</h3>
2613
-
2614
- <p><span class="arg">img</span>.sketch(<span class=
2615
- "arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0,
2616
- <span class="arg">angle</span>=0.0) -&gt; <em>image</em></p>
2617
- </div>
2618
-
2619
- <div class="desc">
2620
- <h4>Description</h4>
2621
-
2622
- <p>Simulates a pencil sketch. For best results start with a
2623
- grayscale image.</p>
2624
-
2625
- <h4>Arguments</h4>
2626
-
2627
- <dl>
2628
- <dt>radius, sigma</dt>
2629
-
2630
- <dd>The radius and sigma of the Gaussian operator</dd>
2631
-
2632
- <dt>angle</dt>
2633
-
2634
- <dd>The angle toward which the image is sketched.</dd>
2635
- </dl>
2636
-
2637
- <h4>Returns</h4>
2638
-
2639
- <p>A new image</p>
2640
-
2641
- <h4>Example</h4>
2642
-
2643
- <p class="rollover"><a href=
2644
- "javascript:popup('sketch.rb.html')"><img src="ex/sketch.jpg"
2645
- title="Click to see the example script" alt="sketch example"
2646
- onmouseover="this.src='ex/images/Flower_Hat.jpg'" onmouseout=
2647
- "this.src='ex/sketch.jpg'" /></a> <img src="ex/images/spin.gif"
2648
- alt="" class="spin" title=
2649
- "Mouse over the example to see the original image" /></p>
2650
-
2651
- <h4>Magick API</h4>
2652
-
2653
- <p>SketchImage</p>
2654
- </div>
2655
-
2656
- <div class="sig">
2657
- <h3 id="solarize">solarize</h3>
2658
-
2659
- <p><span class="arg">img</span>.solarize(<span class=
2660
- "arg">threshold</span>=50) -&gt; <em>image</em></p>
2661
- </div>
2662
-
2663
- <div class="desc">
2664
- <h4>Description</h4>
2665
-
2666
- <p class="imquote">Applies a special effect to the image
2667
- similar to the effect achieved in a photo darkroom by
2668
- selectively exposing areas of photo sensitive paper to
2669
- light.</p>
2670
-
2671
- <h4>Arguments</h4>
2672
-
2673
- <p><span class="imquote">Ranges from 0 to QuantumRange and is a
2674
- measure of the extent of the solarization.</span> The default
2675
- is 50.</p>
2676
-
2677
- <h4>Returns</h4>
2678
-
2679
- <p>A new image</p>
2680
-
2681
- <h4>Example</h4>
2682
-
2683
- <p class="rollover"><a href=
2684
- "javascript:popup('solarize.rb.html')"><img src=
2685
- "ex/solarize.jpg" title="Click to see the example script" alt=
2686
- "solarize example" onmouseover=
2687
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
2688
- "this.src='ex/solarize.jpg'" /></a> <img src=
2689
- "ex/images/spin.gif" alt="" class="spin" title=
2690
- "Mouse over the example to see the original image" /></p>
2691
-
2692
- <h4>Magick API</h4>
2693
-
2694
- <p>SolarizeImage</p>
2695
- </div>
2696
-
2697
- <div class="sig">
2698
- <h3 id="sparse_color">sparse_color</h3>
2699
-
2700
- <p><span class="arg">img</span>.sparse_color(<span class=
2701
- "arg">method</span>, <span class="arg">x1</span>, <span class=
2702
- "arg">y1</span>, <span class="arg">color1</span>[, <span class=
2703
- "arg">x2</span>, <span class="arg">y2</span>, <span class=
2704
- "arg">color2</span>...][, <span class="arg">channel</span>...])
2705
- -&gt; <em>image</em></p>
2706
- </div>
2707
-
2708
- <div class="desc">
2709
- <h4>Description</h4>
2710
-
2711
- <p>Fills the image with the specified <span class=
2712
- "arg">color</span> or colors, starting at the <span class=
2713
- "arg">x</span>,<span class="arg">y</span> coordinates
2714
- associated with the color and using the specified interpolation
2715
- <span class="arg">method</span>.</p>
2716
-
2717
- <p>For more information about this method see the ImageMagick
2718
- documentation for the -sparse-color option. Also see <a href=
2719
- "http://www.imagemagick.org/Usage/canvas/#sparse-color">Sparse
2720
- Points of Color</a> at <a href=
2721
- "http://www.imagemagick.org/Usage/">Examples of ImageMagick
2722
- Usage</a>.</p>
2723
-
2724
- <h4>Arguments</h4>
2725
-
2726
- <dl>
2727
- <dt>method</dt>
2728
-
2729
- <dd>
2730
- One of the following interpolation methods:
2731
-
2732
- <dl>
2733
- <dt>BarycentricColorInterpolate</dt>
2734
-
2735
- <dd class="imquote">Three point triangle of color given 3
2736
- points. Giving only 2 points will form a linear gradient
2737
- between those points. Gradient is however not restricted
2738
- to just the triangle or line.</dd>
2739
-
2740
- <dt>BilinearColorInterpolate</dt>
2741
-
2742
- <dd class="imquote">Like barycentric but for 4 points.
2743
- Less than 4 points fall back to barycentric.</dd>
2744
-
2745
- <dt>ShepardsColorInterpolate</dt>
2746
-
2747
- <dd class="imquote">Colors points basied on the ratio of
2748
- inverse distance squared. Generating spots of color in a
2749
- sea of the average of colors.</dd>
2750
-
2751
- <dt>VoronoiColorInterpolate</dt>
2752
-
2753
- <dd class="imquote">Simply map each pixel to the to
2754
- nearest color point given. The result are polygonal
2755
- 'cells' of solid color.</dd>
2756
- </dl>
2757
- </dd>
2758
-
2759
- <dt>xn, yn, colorn</dt>
2760
-
2761
- <dd>One or more <span class="arg">x</span>,<span class=
2762
- "arg">y</span>, <span class="arg">color</span> triplets.
2763
- <span class="arg">X</span> and <span class="arg">y</span> are
2764
- floating-point values. <span class="arg">Color</span> can be
2765
- either a <a href="imusage.html#color_names">color name</a> or
2766
- a <a href="struct.html#Pixel">pixel</a>.</dd>
2767
-
2768
- <dt>channel...</dt>
2769
-
2770
- <dd>0 or more <a href=
2771
- "constants.html#ChannelType">ChannelType</a> arguments. If no
2772
- channels are specified then DefaultChannels is used.</dd>
2773
- </dl>
2774
-
2775
- <h4>Example</h4>
2776
-
2777
- <p><a href="javascript:popup('sparse_color.rb.html')"><img src=
2778
- "ex/sparse_color.png" title="Click to see the example script"
2779
- alt="sparse_color example" /></a></p>
2780
-
2781
- <h4>Returns</h4>
2782
-
2783
- <p>A new image</p>
2784
-
2785
- <h4>Magick API</h4>
2786
-
2787
- <p>SparseColorImage (available in 6.4.3)</p>
2788
- </div>
2789
-
2790
- <div class="sig">
2791
- <h3 id="splice">splice</h3>
2792
-
2793
- <p><span class="arg">img</span>.splice(<span class=
2794
- "arg">x</span>, <span class="arg">y</span>, <span class=
2795
- "arg">width</span>, <span class="arg">height</span>[,
2796
- <span class="arg">color</span>]) -&gt; <em>image</em></p>
2797
- </div>
2798
-
2799
- <div class="desc">
2800
- <h4>Description</h4>
2801
-
2802
- <p>Splice a solid color into the image as defined by the
2803
- <code>x</code>, <code>y</code>, <code>width</code>, and
2804
- <code>height</code> arguments. This method is the opposite of
2805
- <a href="image1.html#chop">chop</a>.</p>
2806
-
2807
- <h4>Arguments</h4>
2808
-
2809
- <dl>
2810
- <dt>x, y, width, height</dt>
2811
-
2812
- <dd>Describe the rectangle to be spliced.</dd>
2813
-
2814
- <dt>color</dt>
2815
-
2816
- <dd>The color to be spliced. Either a <a href=
2817
- "imusage.html#color_names">color name</a> or a <a href=
2818
- "struct.html#Pixel">pixel</a>. If omitted, uses the image's
2819
- background color.</dd>
2820
- </dl>
2821
-
2822
- <h4>Returns</h4>
2823
-
2824
- <p>A new image</p>
2825
-
2826
- <h4>Example</h4>
2827
-
2828
- <p class="rollover"><a href=
2829
- "javascript:popup('splice.rb.html')">
2830
- <!-- This img tag displays the original image when the mouse is over -->
2831
- <img style=
2832
- "padding-left:8px;padding-right:8px;padding-bottom:10px;padding-bottom:10px; display:none"
2833
- id="nosplice" onmouseout=
2834
- "this.style.display='none';spliced.style.display='';" src=
2835
- "ex/images/Flower_Hat.jpg" alt="splice example" title=
2836
- "Click to see the example script" /><!--
2837
- This img tag displays the spliced image when the mouse is not over
2838
- --><img class="hide"
2839
- id="spliced" onmouseover=
2840
- "this.style.display='none';nosplice.style.display='';" src=
2841
- "ex/splice.jpg" alt="splice example" /></a> <img src=
2842
- "ex/images/spin.gif" alt="" style="margin-bottom: 250px" title=
2843
- "Mouse over the example to see the original image" /></p>
2844
-
2845
- <h4>See also</h4>
2846
-
2847
- <p><a href=
2848
- "image1.html#color_fill_to_border">color_fill_to_border</a>,
2849
- <a href="image1.html#color_floodfill">color_floodfill</a>,
2850
- <a href="image1.html#color_reset_bang">color_reset!</a>,
2851
- <a href="image2.html#erase_bang">erase!</a>, <a href=
2852
- "image2.html#opaque">opaque</a></p>
2853
-
2854
- <h4>Magick API</h4>
2855
-
2856
- <p>SpliceImage</p>
2857
- </div>
2858
-
2859
- <div class="sig">
2860
- <h3 id="spread">spread</h3>
2861
-
2862
- <p><span class="arg">img</span>.spread(<span class=
2863
- "arg">radius</span>=3) -&gt; <em>image</em></p>
2864
- </div>
2865
-
2866
- <div class="desc">
2867
- <h4>Description</h4>
2868
-
2869
- <p class="imquote">Randomly displaces each pixel in a block
2870
- defined by the <span class="arg"><em>radius</em></span>
2871
- parameter.</p>
2872
-
2873
- <h4>Returns</h4>
2874
-
2875
- <p>A new image</p>
2876
-
2877
- <h4>Example</h4>
2878
-
2879
- <p class="rollover"><a href=
2880
- "javascript:popup('spread.rb.html')"><img src="ex/spread.jpg"
2881
- alt="spread example" title="Click to see the example script"
2882
- onmouseover="this.src='ex/images/Flower_Hat.jpg'" onmouseout=
2883
- "this.src='ex/spread.jpg'" /></a> <img src="ex/images/spin.gif"
2884
- alt="" class="spin" title=
2885
- "Mouse over the example to see the original image" /></p>
2886
-
2887
- <h4>Magick API</h4>
2888
-
2889
- <p>SpreadImage</p>
2890
- </div>
2891
-
2892
- <div class="sig">
2893
- <h3 id="stegano">stegano</h3>
2894
-
2895
- <p><span class="arg">img</span>.stegano(<span class=
2896
- "arg">watermark</span>, <span class="arg">offset</span>) -&gt;
2897
- <em>image</em></p>
2898
- </div>
2899
-
2900
- <div class="desc">
2901
- <h4>Description</h4>
2902
-
2903
- <p>Hides a digital watermark in the receiver. You can retrieve
2904
- the watermark by reading the file with the
2905
- <code>stegano:</code> prefix, thereby proving the authenticity
2906
- of the file.</p>
2907
-
2908
- <p>The watermarked image must be saved in a lossless RGB format
2909
- such as MIFF, or PNG. You cannot save a watermarked image in a
2910
- lossy format such as JPEG or a pseudocolor format such as GIF.
2911
- Once written, the file must not be modified or processed in any
2912
- way.</p>
2913
-
2914
- <h4>Arguments</h4>
2915
-
2916
- <dl>
2917
- <dt>watermark</dt>
2918
-
2919
- <dd>An image or imagelist to be used as the watermark. The
2920
- watermark must be grayscale and should be substantially
2921
- smaller than the receiver. The recovery time is proportional
2922
- to the size of the watermark.</dd>
2923
-
2924
- <dt>offset</dt>
2925
-
2926
- <dd>The starting position within the receiver at which the
2927
- watermark will be hidden. When you retrieve the watermark
2928
- from the file, you must supply this value, along with the
2929
- width and height of the watermark, in the <a href=
2930
- "info.html#Info.size_eq">size</a> optional parameter to the
2931
- <a href="image1.html#read">read</a> method.</dd>
2932
- </dl>
2933
-
2934
- <h4>Returns</h4>
2935
-
2936
- <p>A copy of the image containing the embedded watermark.</p>
2937
-
2938
- <h4>Example</h4>
2939
-
2940
- <p><a href="javascript:popup('stegano.rb.html')"><img src=
2941
- "ex/stegano.gif" title="Click to see the example script" alt=
2942
- "stegano example" /></a></p>
2943
-
2944
- <h4>Magick API</h4>
2945
-
2946
- <p>SteganoImage</p>
2947
-
2948
- <h4>See also</h4>
2949
-
2950
- <p><a href="#watermark">watermark</a></p>
2951
- </div>
2952
-
2953
- <div class="sig">
2954
- <h3 id="stereo">stereo</h3>
2955
-
2956
- <p><span class="arg">img</span>.stereo(<span class=
2957
- "arg">offset_image</span>) -&gt; <em>image</em></p>
2958
- </div>
2959
-
2960
- <div class="desc">
2961
- <h4>Description</h4>
2962
-
2963
- <p class="imquote">Combines two images and produces a single
2964
- image that is the composite of a left and right image of a
2965
- stereo pair. Special red-green stereo glasses are required to
2966
- view this effect.</p>
2967
-
2968
- <h4>Arguments</h4>
2969
-
2970
- <p>Another image or imagelist. If the argument is an imagelist,
2971
- uses the current image.</p>
2972
-
2973
- <h4>Returns</h4>
2974
-
2975
- <p>A new image</p>
2976
-
2977
- <h4>Magick API</h4>
2978
-
2979
- <p>StereoImage</p>
2980
- </div>
2981
-
2982
- <div class="sig">
2983
- <h3 id="store_pixels">store_pixels</h3>
2984
-
2985
- <p><span class="arg">img</span>.store_pixels(<span class=
2986
- "arg">x</span>, <span class="arg">y</span>, <span class=
2987
- "arg">columns</span>, <span class="arg">rows</span>,
2988
- <span class="arg">pixels</span>) -&gt; <em>image</em></p>
2989
- </div>
2990
-
2991
- <div class="desc">
2992
- <h4>Description</h4>
2993
-
2994
- <p>Replace the pixels in the specified rectangle with the
2995
- pixels in the <em>pixels</em> array.</p>
2996
-
2997
- <h4>Arguments</h4>
2998
-
2999
- <dl>
3000
- <dt>x, y</dt>
3001
-
3002
- <dd>The x- and y-offset of the rectangle to be replaced.</dd>
3003
-
3004
- <dt>columns, rows</dt>
3005
-
3006
- <dd>The number of rows and columns in the rectangle.</dd>
3007
-
3008
- <dt>pixels</dt>
3009
-
3010
- <dd>An array of <a href="struct.html#Pixel">pixels</a>. The
3011
- number of pixels in the array must be the same as the number
3012
- of pixels in the rectangle, that is,
3013
- <code>rows*columns</code>.</dd>
3014
- </dl>
3015
-
3016
- <h4>Returns</h4>
3017
-
3018
- <p>The image, with the rectangle suitably altered.</p>
3019
-
3020
- <h4>Example</h4>
3021
-
3022
- <p><a href="javascript:popup('smile.rb.html')"><img src=
3023
- "ex/smile.gif" title="Click to see the example script" alt=
3024
- "smile example" /></a></p>
3025
-
3026
- <p>Also see the example for <a href=
3027
- "image2.html#get_pixels"><code>get_pixels</code></a>.</p>
3028
-
3029
- <h4>See also</h4>
3030
-
3031
- <p><a href="image1.html#constitute">constitute</a>, <a href=
3032
- "image2.html#get_pixels">get_pixels</a>, <a href=
3033
- "#view">view</a></p>
3034
-
3035
- <h4>Magick API</h4>
3036
-
3037
- <p>SetImagePixels, SyncImagePixels</p>
3038
- </div>
3039
-
3040
- <div class="sig">
3041
- <h3 id="strip_bang">strip!</h3>
3042
-
3043
- <p><span class="arg">img</span>.strip! -&gt; <em>self</em></p>
3044
- </div>
3045
-
3046
- <div class="desc">
3047
- <h4>Description</h4>
3048
-
3049
- <p class="imquote">Strips an image of all profiles and
3050
- comments.</p>
3051
-
3052
- <h4>Returns</h4>
3053
-
3054
- <p>self</p>
3055
-
3056
- <h4>Magick API</h4>
3057
-
3058
- <p>StripImage</p>
3059
- </div>
3060
-
3061
- <div class="sig">
3062
- <h3 id="swirl">swirl</h3>
3063
-
3064
- <p><span class="arg">img</span>.swirl(<span class=
3065
- "arg">degrees</span>) -&gt; <em>image</em></p>
3066
- </div>
3067
-
3068
- <div class="desc">
3069
- <h4>Description</h4>
3070
-
3071
- <p class="imquote">Swirls the pixels about the center of the
3072
- image, where degrees indicates the sweep of the arc through
3073
- which each pixel is moved. You get a more dramatic effect as
3074
- the degrees move from 1 to 360.</p>
3075
-
3076
- <h4>Arguments</h4>
3077
-
3078
- <p>The number of degrees to swirl the image.</p>
3079
-
3080
- <h4>Returns</h4>
3081
-
3082
- <p>A new image</p>
3083
-
3084
- <h4>Example</h4>
3085
-
3086
- <p>This example is an animated image. Mouse over the image to
3087
- start the animation.</p>
3088
-
3089
- <p class="rollover"><a href=
3090
- "javascript:popup('swirl.rb.html')"><img onmouseover=
3091
- "this.src='ex/swirl.gif'" onmouseout=
3092
- "this.src='ex/images/Flower_Hat.jpg'" src=
3093
- "ex/images/Flower_Hat.jpg" alt="swirl example" title=
3094
- "Click the image to see the example script" /></a><img src=
3095
- "ex/images/spin.gif" alt="" class="spin" title=
3096
- "Mouse over the example to see the animation" /></p>
3097
-
3098
- <h4>Magick API</h4>
3099
-
3100
- <p>SwirlImage</p>
3101
- </div>
3102
-
3103
- <div class="sig">
3104
- <h3 id="sync_profiles">sync_profiles</h3>
3105
-
3106
- <p><span class="arg">img</span>.sync_profiles -&gt;
3107
- <code>true</code> or <code>false</code></p>
3108
- </div>
3109
-
3110
- <div class="desc">
3111
- <h4>Description</h4>
3112
-
3113
- <p class="imquote">Synchronizes image properties with the image
3114
- profiles.</p>
3115
-
3116
- <h4>Returns</h4>
3117
-
3118
- <p><code>True</code> if everything went okay,
3119
- <code>false</code> if there was a problem with the profile.</p>
3120
-
3121
- <h4>Notes</h4>
3122
-
3123
- <p class="imquote">Currently we only support updating the EXIF
3124
- resolution and orientation.</p>
3125
-
3126
- <h4>Magick API</h4>
3127
-
3128
- <p>SyncImageProfiles</p>
3129
- </div>
3130
-
3131
- <div class="sig">
3132
- <h3 id="texture_fill_to_border">texture_fill_to_border</h3>
3133
-
3134
- <p><span class=
3135
- "arg">img</span>.texture_fill_to_border(<span class=
3136
- "arg">x</span>, <span class="arg">y</span>, <span class=
3137
- "arg">texture</span>) -&gt; <em>image</em></p>
3138
- </div>
3139
-
3140
- <div class="desc">
3141
- <h4>Description</h4>
3142
-
3143
- <p>Replaces the target pixel at <span class="arg">x</span>,
3144
- <span class="arg">y</span> and its neighbors that are not the
3145
- border color with copies of the <span class=
3146
- "arg">texture</span> image. Use the <a href=
3147
- "imageattrs.html#fuzz">fuzz</a> attribute to specify how
3148
- closely a pixel must match the border color.</p>
3149
-
3150
- <h4>Arguments</h4>
3151
-
3152
- <dl>
3153
- <dt>x, y</dt>
3154
-
3155
- <dd>The x- and y-offset of the target pixel.</dd>
3156
-
3157
- <dt>texture</dt>
3158
-
3159
- <dd>An image or imagelist. If an imagelist, uses the current
3160
- image.</dd>
3161
- </dl>
3162
-
3163
- <h4>Returns</h4>
3164
-
3165
- <p>A new image</p>
3166
-
3167
- <h4>Example</h4>
3168
-
3169
- <p>In this example the target is the pixel in the center of the
3170
- image. The texture - in this case a picture of a girl in a
3171
- flowered hat - replaces this pixel and its neighbors until
3172
- reaching a black pixel. Mouse over the image to see the
3173
- original image. Notice the plum-colored circles are replaced as
3174
- well. Compare this result with the result of
3175
- <code>texture_floodfill</code>, below.</p>
3176
-
3177
- <p class="rollover"><a href=
3178
- "javascript:popup('texture_fill_to_border.rb.html')"><img src=
3179
- "ex/texture_fill_to_border_after.gif" alt=
3180
- "texture_fill_to_border example" onmouseover=
3181
- "this.src='ex/texture_fill_to_border_before.gif'" onmouseout=
3182
- "this.src='ex/texture_fill_to_border_after.gif'" title=
3183
- "Click to see the example script" /></a> <img src=
3184
- "ex/images/spin.gif" alt="" class="spin" style="left:206px;"
3185
- title="Mouse over the example to see the original image" /></p>
3186
-
3187
- <h4>See also</h4>
3188
-
3189
- <p><a href=
3190
- "image1.html#color_fill_to_border">color_fill_to_border</a>,
3191
- <a href=
3192
- "image2.html#matte_fill_to_border">matte_fill_to_border</a></p>
3193
-
3194
- <h4>Magick API</h4>
3195
-
3196
- <p>ColorFloodfillImage</p>
3197
- </div>
3198
-
3199
- <div class="sig">
3200
- <h3 id="texture_floodfill">texture_floodfill</h3>
3201
-
3202
- <p><span class="arg">img</span>.texture_floodfill(<span class=
3203
- "arg">x</span>, <span class="arg">y</span>, <span class=
3204
- "arg">texture</span>) -&gt; <em>image</em></p>
3205
- </div>
3206
-
3207
- <div class="desc">
3208
- <h4>Description</h4>
3209
-
3210
- <p>Replaces the target pixel at <span class="arg">x</span>,
3211
- <span class="arg">y</span> and its neighbors that are the same
3212
- color with the <span class="arg">texture</span> image. By
3213
- default, the neighbor pixels must be exactly the same color as
3214
- the target pixel. Use the <a href=
3215
- "imageattrs.html#fuzz">fuzz</a> attribute to specify how much
3216
- difference is acceptable.</p>
3217
-
3218
- <h4>Arguments</h4>
3219
-
3220
- <dl>
3221
- <dt>x, y</dt>
3222
-
3223
- <dd>The x- and y-offset of the target pixel.</dd>
3224
-
3225
- <dt>texture</dt>
3226
-
3227
- <dd>An image or imagelist. If an imagelist, uses the current
3228
- image.</dd>
3229
- </dl>
3230
-
3231
- <h4>Returns</h4>
3232
-
3233
- <p>A new image</p>
3234
-
3235
- <h4>Example</h4>
3236
-
3237
- <p>In this example the target is the pixel in the center of the
3238
- image. The texture - in this case a picture of a girl in a
3239
- flowered hat - replaces this pixel and its same-colored
3240
- neighbors. Mouse over the image to see the original image.
3241
- Notice the plum-colored circles are not replaced. Compare this
3242
- result with the result of <code>texture_fill_to_border</code>,
3243
- above.</p>
3244
-
3245
- <p class="rollover"><a href=
3246
- "javascript:popup('texture_floodfill.rb.html')"><img src=
3247
- "ex/texture_floodfill_after.gif" alt=
3248
- "texture_floodfill example" onmouseover=
3249
- "this.src='ex/texture_floodfill_before.gif'" onmouseout=
3250
- "this.src='ex/texture_floodfill_after.gif'" title=
3251
- "Click to see the example script" /></a><img src=
3252
- "ex/images/spin.gif" alt="" class="spin" style="left:206px;"
3253
- title="Mouse over the example to see the original image" /></p>
3254
-
3255
- <h4>See also</h4>
3256
-
3257
- <p><a href="image1.html#color_floodfill">color_floodfill</a>,
3258
- <a href="image2.html#matte_floodfill">matte_floodfill</a></p>
3259
-
3260
- <h4>Magick API</h4>
3261
-
3262
- <p>ColorFloodfillImage</p>
3263
- </div>
3264
-
3265
- <div class="sig">
3266
- <h3 id="threshold">threshold</h3>
3267
-
3268
- <p><span class="arg">img</span>.threshold(<span class=
3269
- "arg">threshold</span>) -&gt; <em>image</em></p>
3270
- </div>
3271
-
3272
- <div class="desc">
3273
- <h4>Description</h4>
3274
-
3275
- <p class="imquote">Changes the value of individual pixels based
3276
- on the intensity of each pixel compared to <span class=
3277
- "arg">threshold</span>. The result is a high-contrast, two
3278
- color image.</p>
3279
-
3280
- <h4>Arguments</h4>
3281
-
3282
- <p>A value between 0 and QuantumRange.</p>
3283
-
3284
- <h4>Returns</h4>
3285
-
3286
- <p>A new image</p>
3287
-
3288
- <h4>Example</h4>
3289
-
3290
- <p><code>threshold(MaxRGB*0.55)</code></p>
3291
-
3292
- <p class="rollover"><a href=
3293
- "javascript:popup('threshold.rb.html')"><img src=
3294
- "ex/threshold.jpg" onmouseover=
3295
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
3296
- "this.src='ex/threshold.jpg'" title=
3297
- "Click to see the example script" alt=
3298
- "threshold example" /></a><img src="ex/images/spin.gif" alt=""
3299
- class="spin" title=
3300
- "Mouse over the example to see the original image" /></p>
3301
-
3302
- <h4>See also</h4>
3303
-
3304
- <p><a href=
3305
- "image1.html#adaptive_threshold">adaptive_threshold</a>,
3306
- <a href="image1.html#bilevel_channel">bilevel_channel</a>,
3307
- <a href=
3308
- "#random_threshold_channel">random_threshold_channel</a></p>
3309
-
3310
- <h4>Magick API</h4>
3311
-
3312
- <p>ThresholdImage</p>
3313
- </div>
3314
-
3315
- <div class="sig">
3316
- <h3 id="thumbnail">thumbnail</h3>
3317
-
3318
- <p><span class="arg">img</span>.thumbnail(<span class=
3319
- "arg">new_width</span>, <span class="arg">new_height</span>)
3320
- -&gt; <em>image</em><br />
3321
- <span class="arg">img</span>.thumbnail(<span class=
3322
- "arg">scale_factor</span>) -&gt; <em>image</em></p>
3323
- </div>
3324
-
3325
- <div class="desc">
3326
- <h4>Description</h4>
3327
-
3328
- <p>The <code>thumbnail</code> method is a fast resizing method
3329
- suitable for use when the size of the resulting image is &lt;
3330
- 10% of the original.</p>
3331
-
3332
- <h4>Arguments</h4>
3333
-
3334
- <p>You can call <code>thumbnail</code> with either the new
3335
- width and height or the scale factor.</p>
3336
-
3337
- <dl>
3338
- <dt>new_width, new_height</dt>
3339
-
3340
- <dd>The desired width and height in pixels.</dd>
3341
-
3342
- <dt>scale_factor</dt>
3343
-
3344
- <dd>The desired size represented as a floating-point number.
3345
- For example, to make a thumbnail that is 9.5% of the size of
3346
- the original image, use <code>0.095</code>.</dd>
3347
- </dl>
3348
-
3349
- <h4>Returns</h4>
3350
-
3351
- <p>A new image</p>
3352
-
3353
- <h4>Example</h4>
3354
- <pre>
3355
- img = Image.read("images/Cheetah.jpg").first
3356
- thumbnail = img.thumbnail(img.columns*0.09, img.rows*0.09)
3357
- </pre>
3358
-
3359
- <h4>See also</h4>
3360
-
3361
- <p><a href="image2.html#minify">minify</a>, <a href=
3362
- "#resize">resize</a>, <a href="#sample">sample</a>, <a href=
3363
- "#scale">scale</a></p>
3364
-
3365
- <h4>Magick API</h4>
3366
-
3367
- <p>ThumbnailImage</p>
3368
- </div>
3369
-
3370
- <div class="sig">
3371
- <h3 id="thumbnail_bang">thumbnail!</h3>
3372
-
3373
- <p><span class="arg">img</span>.thumbnail!(<span class=
3374
- "arg">new_width</span>, <span class="arg">new_height</span>)
3375
- -&gt; <em>self</em><br />
3376
- <span class="arg">img</span>.thumbnail!(<span class=
3377
- "arg">scale_factor</span>) -&gt; <em>self</em></p>
3378
- </div>
3379
-
3380
- <div class="desc">
3381
- <h4>Description</h4>
3382
-
3383
- <p>In-place form of <a href="#thumbnail">thumbnail</a>.</p>
3384
-
3385
- <h4>Returns</h4>
3386
-
3387
- <p>self</p>
3388
- </div>
3389
-
3390
- <div class="sig">
3391
- <h3 id="to_blob">to_blob</h3>
3392
-
3393
- <p><span class="arg">img</span>.to_blob <span class="arg">[ {
3394
- optional arguments } ]</span>-&gt; <em>string</em></p>
3395
- </div>
3396
-
3397
- <div class="desc">
3398
- <h4>Description</h4>
3399
-
3400
- <p>Creates a <em>B</em>inary <em>L</em>arge <em>OB</em>ject, a
3401
- direct-to-memory version of the image. The <a href=
3402
- "image1.html#from_blob">from_blob</a> method constructs an
3403
- image from a BLOB created by this method.</p>
3404
-
3405
- <h4>Arguments</h4>
3406
-
3407
- <p>No required arguments, however you can specify the image
3408
- format (such as JPEG, PNG, etc.) and depth by calling the
3409
- <a href="imageattrs.html#format">format</a> and <a href=
3410
- "imageattrs.html#Image.depth">depth</a> attributes, as well as
3411
- other <a href="info.html">Image::Info</a> attributes as
3412
- appropriate, in a block associated with the method.</p>
3413
-
3414
- <h4>Returns</h4>
3415
-
3416
- <p>A string containing the image data represented as a
3417
- BLOB.</p>
3418
-
3419
- <h4>Example</h4>
3420
-
3421
- <p><a href="javascript:popup('to_blob.rb.html')"><img src=
3422
- "ex/to_blob.gif" alt="to_blob example" title=
3423
- "Click to see the example script" /></a></p>
3424
-
3425
- <h4>See also</h4>
3426
-
3427
- <p><a href="image1.html#from_blob">from_blob</a></p>
3428
-
3429
- <h4>Magick API</h4>
3430
-
3431
- <p>ImageToBlob</p>
3432
- </div>
3433
-
3434
- <div class="sig">
3435
- <h3 id="to_color">to_color</h3>
3436
-
3437
- <p><span class="arg">img</span>.to_color(<span class=
3438
- "arg">pixel</span>) -&gt; <em>string</em></p>
3439
- </div>
3440
-
3441
- <div class="desc">
3442
- <h4>Description</h4>
3443
-
3444
- <p>Returns the color name for a pixel. Unlike the
3445
- <code>Pixel#to_color</code> method, to_color uses the <a href=
3446
- "imageattrs.html#Image.depth">depth</a> and <a href=
3447
- "imageattrs.html#Image.matte">matte</a> attributes of the image
3448
- to determine the color name.</p>
3449
-
3450
- <h4>Arguments</h4>
3451
-
3452
- <p>A <a href="struct.html#Pixel">Pixel</a> object.</p>
3453
-
3454
- <h4>Returns</h4>
3455
-
3456
- <p>A <a href="imusage.html#color_names">color name</a>.</p>
3457
-
3458
- <h4>Example</h4>
3459
- <pre>
3460
- img = Image.read('ex/images/Flower_Hat.jpg').first
3461
- &raquo; ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b
3462
- pixel = img.pixel_color(img.columns/2, img.rows/2)
3463
- &raquo; #&lt;struct Pixel red=216, green=147, blue=106, opacity=0&gt;
3464
- img.to_color(pixel)
3465
- &raquo; "#D8936A"
3466
- </pre>
3467
-
3468
- <h4>See also</h4>
3469
-
3470
- <p><a href="struct.html#Pixel">Pixel#to_color</a></p>
3471
-
3472
- <h4>Magick API</h4>
3473
-
3474
- <p>QueryColorname</p>
3475
- </div>
3476
-
3477
- <div class="sig">
3478
- <h3 id="transparent">transparent</h3>
3479
-
3480
- <p><span class="arg">img</span>.transparent(<span class=
3481
- "arg">color</span>, <span class=
3482
- "arg">opacity</span>=TransparentOpacity) -&gt;
3483
- <em>image</em></p>
3484
- </div>
3485
-
3486
- <div class="desc">
3487
- <h4>Description</h4>
3488
-
3489
- <p>Changes the opacity value of all the pixels that match
3490
- <span class="arg">color</span> to the value specified by
3491
- <span class="arg">opacity</span>. By default the pixel must
3492
- match exactly, but you can specify a tolerance level by setting
3493
- the <a href="imageattrs.html#fuzz">fuzz</a> attribute on the
3494
- image.</p>
3495
-
3496
- <h4>Arguments</h4>
3497
-
3498
- <dl>
3499
- <dt>color</dt>
3500
-
3501
- <dd>Either a <a href="imusage.html#color_names">color
3502
- name</a> or a <a href="struct.html#Pixel">pixel</a>.</dd>
3503
-
3504
- <dt>opacity</dt>
3505
-
3506
- <dd>The new opacity value, either an <a href=
3507
- "constants.html#Opacity">opacity</a> value or a number
3508
- between 0 and QuantumRange. The default is
3509
- TransparentOpacity.</dd>
3510
- </dl>
3511
-
3512
- <h4>Returns</h4>
3513
-
3514
- <p>A new image</p>
3515
-
3516
- <h4>Example</h4>
3517
-
3518
- <p>Mouse over the image to see the original. In this example,
3519
- all the black pixels are made transparent. The resulting image
3520
- has been composited over a plasma background, which shows
3521
- through the transparent pixels.</p>
3522
-
3523
- <p class="rollover"><a href=
3524
- "javascript:popup('transparent.rb.html')"><img src=
3525
- "ex/transparent_after.gif" title=
3526
- "Click to see the example script" onmouseover=
3527
- "this.src='ex/transparent_before.gif'" onmouseout=
3528
- "this.src='ex/transparent_after.gif'" alt=
3529
- "transparent example" /></a><img src="ex/images/spin.gif" alt=
3530
- "" class="spin" title=
3531
- "Mouse over the example to see the original image" /></p>
3532
-
3533
- <h4>See also</h4>
3534
-
3535
- <p><a href="image2.html#matte_replace">matte_replace</a>,
3536
- <a href="draw.html#matte">Draw#matte</a>, <a href=
3537
- "#paint_transparent">paint_transparent</a>, <a href=
3538
- "#transparent_chroma">transparent_chroma</a></p>
3539
-
3540
- <h4>Magick API</h4>
3541
-
3542
- <p>TransparentPaintImage</p>
3543
- </div>
3544
-
3545
- <div class="sig">
3546
- <h3 id="transparent_chroma">transparent_chroma</h3>
3547
-
3548
- <p><span class="arg">img</span>.transparent_chroma(<span class=
3549
- "arg">low</span>, <span class="arg">high</span>, <span class=
3550
- "arg">opacity</span>=TransparentOpacity, <span class=
3551
- "arg">invert</span>=<code>false</code>) -&gt;
3552
- <em>image</em></p>
3553
- </div>
3554
-
3555
- <div class="desc">
3556
- <h4>Description</h4>
3557
-
3558
- <p>Changes the opacity value associated with any pixel between
3559
- <span class="arg">low</span> and <span class="arg">high</span>
3560
- to the value defined by <span class="arg">opacity</span>.</p>
3561
-
3562
- <p class="imquote">As there is one fuzz value for the all the
3563
- channels, the <a href="#transparent">transparent</a> method is
3564
- not suitable for the operations like chroma, where the
3565
- tolerance for similarity of two color components (RGB) can be
3566
- different, Thus we define this method take two target pixels
3567
- (one low and one high) and all the pixels of an image which are
3568
- lying between these two pixels are made transparent.</p>
3569
-
3570
- <h4>Arguments</h4>
3571
-
3572
- <dl>
3573
- <dt>low, high</dt>
3574
-
3575
- <dd>The low and high ends of the pixel range</dd>
3576
-
3577
- <dt>opacity</dt>
3578
-
3579
- <dd>The desired opacity. The default value is
3580
- transparent.</dd>
3581
-
3582
- <dt>invert</dt>
3583
-
3584
- <dd>If true, all pixels outside the range are set to
3585
- <span class="arg">opacity</span>.</dd>
3586
- </dl>
3587
-
3588
- <h4>Returns</h4>
3589
-
3590
- <p>A new image</p>
3591
-
3592
- <h4>Magick API</h4>
3593
-
3594
- <p>TransparentPaintImageChroma (available in ImageMagick
3595
- 6.4.5-6)</p>
3596
- </div>
3597
-
3598
- <div class="sig">
3599
- <h3 id="transpose">transpose</h3>
3600
-
3601
- <p><span class="arg">img</span>.transpose -&gt;
3602
- <em>image</em></p>
3603
- </div>
3604
-
3605
- <div class="desc">
3606
- <h4>Description</h4>
3607
-
3608
- <p class="imquote">Creates a horizontal mirror image by
3609
- reflecting the pixels around the central y-axis while rotating
3610
- them by 90 degrees.</p>
3611
-
3612
- <h4>Returns</h4>
3613
-
3614
- <p>A new image</p>
3615
-
3616
- <h4>Example</h4>
3617
-
3618
- <p class="rollover"><a href=
3619
- "javascript:popup('transpose.rb.html')"><img src=
3620
- "ex/transpose.jpg" alt="transpose example" title=
3621
- "Click to see the example script" onmouseover=
3622
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
3623
- "this.src='ex/transpose.jpg'" /></a> <img src=
3624
- "ex/images/spin.gif" alt="" class="spin" style="left:252px;"
3625
- title="Mouse over the example to see the original image" /></p>
3626
-
3627
- <h4>See also</h4>
3628
-
3629
- <p><a href="image2.html#flip">flip</a>, <a href=
3630
- "image2.html#flop">flop</a>, <a href=
3631
- "image3.html#rotate">rotate</a>, <a href=
3632
- "#transpose_bang">transpose!</a>, <a href=
3633
- "image3.html#transverse">transverse</a></p>
3634
-
3635
- <h4>Magick API</h4>
3636
-
3637
- <p>TransposeImage</p>
3638
- </div>
3639
-
3640
- <div class="sig">
3641
- <h3 id="transpose_bang">transpose!</h3>
3642
-
3643
- <p><span class="arg">img</span>.transpose! -&gt;
3644
- <em>self</em></p>
3645
- </div>
3646
-
3647
- <div class="desc">
3648
- <h4>Description</h4>
3649
-
3650
- <p>In-place form of <a href="#transpose">transpose</a>.</p>
3651
-
3652
- <h4>Returns</h4>
3653
-
3654
- <p>self</p>
3655
- </div>
3656
-
3657
- <div class="sig">
3658
- <h3 id="transverse">transverse</h3>
3659
-
3660
- <p><span class="arg">img</span>.transverse -&gt;
3661
- <em>image</em></p>
3662
- </div>
3663
-
3664
- <div class="desc">
3665
- <h4>Description</h4>
3666
-
3667
- <p class="imquote">Creates a vertical mirror image by
3668
- reflecting the pixels around the central x-axis while rotating
3669
- them by 270 degrees</p>
3670
-
3671
- <h4>Returns</h4>
3672
-
3673
- <p>A new image</p>
3674
-
3675
- <h4>Example</h4>
3676
-
3677
- <p class="rollover"><a href=
3678
- "javascript:popup('transverse.rb.html')"><img src=
3679
- "ex/transverse.jpg" alt="transverse example" title=
3680
- "Click to see the example script" onmouseover=
3681
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
3682
- "this.src='ex/transverse.jpg'" /></a> <img src=
3683
- "ex/images/spin.gif" alt="" class="spin" style="left:252px;"
3684
- title="Mouse over the example to see the original image" /></p>
3685
-
3686
- <h4>See also</h4>
3687
-
3688
- <p><a href="image2.html#flip">flip</a>, <a href=
3689
- "image2.html#flop">flop</a>, <a href=
3690
- "image3.html#rotate">rotate</a>, <a href=
3691
- "image3.html#transpose">transpose</a>, <a href=
3692
- "#transverse_bang">transverse!</a></p>
3693
-
3694
- <h4>Magick API</h4>
3695
-
3696
- <p>TransposeImage</p>
3697
- </div>
3698
-
3699
- <div class="sig">
3700
- <h3 id="transverse_bang">transverse!</h3>
3701
-
3702
- <p><span class="arg">img</span>.transverse! -&gt;
3703
- <em>self</em></p>
3704
- </div>
3705
-
3706
- <div class="desc">
3707
- <h4>Description</h4>
3708
-
3709
- <p>In-place form of <a href="#transverse">transverse</a>.</p>
3710
-
3711
- <h4>Returns</h4>
3712
-
3713
- <p>self</p>
3714
- </div>
3715
-
3716
- <div class="sig">
3717
- <h3 id="trim">trim</h3>
3718
-
3719
- <p><span class="arg">img</span>.trim(<span class=
3720
- "arg">reset</span>=false) -&gt; <em>image</em></p>
3721
- </div>
3722
-
3723
- <div class="desc">
3724
- <h4>Description</h4>
3725
-
3726
- <p class="imquote">Removes the edges that are exactly the same
3727
- color as the corner pixels. Use the <a href=
3728
- "imageattrs.html#fuzz">fuzz</a> attribute to make
3729
- <code>trim</code> remove edges that are nearly the same color
3730
- as the corner pixels.</p>
3731
-
3732
- <h4>Arguments</h4>
3733
-
3734
- <p>The trim method retains the offset information in the
3735
- cropped image. This may cause the image to appear to be
3736
- surrounded by blank or black space when viewed with an external
3737
- viewer. This only occurs when the image is saved in a format
3738
- (such as GIF) that saves offset information. To reset the
3739
- offset data, use true as the argument to trim. See also
3740
- <a href="image1.html#crop">crop</a>.</p>
3741
-
3742
- <h4>Returns</h4>
3743
-
3744
- <p>A new image</p>
3745
-
3746
- <h4>Example</h4>
3747
-
3748
- <p class="rollover"><a href=
3749
- "javascript:popup('trim.rb.html')"><img src="ex/trim_after.jpg"
3750
- onmouseover="this.src='ex/trim_before.jpg'" onmouseout=
3751
- "this.src='ex/trim_after.jpg'" alt="trim example" title=
3752
- "Click to see the example script" /></a> <img src=
3753
- "ex/images/spin.gif" alt="" class="spin" title=
3754
- "Mouse over the image to see the original image" /></p>
3755
-
3756
- <h4>See also</h4>
3757
-
3758
- <p><a href="image1.html#crop">crop</a></p>
3759
-
3760
- <h4>Magick API</h4>
3761
-
3762
- <p>CropImage</p>
3763
- </div>
3764
-
3765
- <div class="sig">
3766
- <h3 id="trim_bang">trim!</h3>
3767
-
3768
- <p><span class="arg">img</span>.trim!(<span class=
3769
- "arg">reset</span>=false) -&gt; <em>self</em></p>
3770
- </div>
3771
-
3772
- <div class="desc">
3773
- <p>In-place form of <a href="#trim">trim</a>.</p>
3774
-
3775
- <h4>Returns</h4>
3776
-
3777
- <p>self</p>
3778
- </div>
3779
-
3780
- <div class="sig">
3781
- <h3 id="unique_colors">unique_colors</h3>
3782
-
3783
- <p><span class="arg">img</span>.unique_colors -&gt;
3784
- <em>image</em></p>
3785
- </div>
3786
-
3787
- <div class="desc">
3788
- <h4>Description</h4>
3789
-
3790
- <p>Constructs a new image with one pixel for each unique color
3791
- in the image. The new image has 1 row. The row has 1 column for
3792
- each unique pixel in the image.</p>
3793
-
3794
- <h4>Returns</h4>
3795
-
3796
- <p>A new image</p>
3797
-
3798
- <h4>Magick API</h4>
3799
-
3800
- <p>UniqueImageColors</p>
3801
- </div>
3802
-
3803
- <div class="sig">
3804
- <h3 id="unsharp_mask">unsharp_mask</h3>
3805
-
3806
- <p><span class="arg">img</span>.unsharp_mask(<span class=
3807
- "arg">radius=0.0</span>, <span class="arg">sigma=1.0</span>,
3808
- <span class="arg">amount=1.0</span>, <span class=
3809
- "arg">threshold=0.05</span>) -&gt; <em>image</em></p>
3810
- </div>
3811
-
3812
- <div class="desc">
3813
- <h4>Description</h4>
3814
-
3815
- <p class="imquote">Sharpens an image. We convolve the image
3816
- with a Gaussian operator of the given <span class=
3817
- "arg">radius</span> and standard deviation (<span class=
3818
- "arg">sigma</span>). For reasonable results, <span class=
3819
- "arg">radius</span> should be larger than <span class=
3820
- "arg">sigma</span>. Use a radius of 0 and
3821
- <code>unsharp_mask</code> selects a suitable radius for
3822
- you.</p>
3823
-
3824
- <h4>Arguments</h4>
3825
-
3826
- <p>All arguments are optional.</p>
3827
-
3828
- <dl>
3829
- <dt>radius</dt>
3830
-
3831
- <dd>The radius of the Gaussian operator. The default is
3832
- 0.0.</dd>
3833
-
3834
- <dt>sigma</dt>
3835
-
3836
- <dd>The standard deviation of the Gaussian operator. A good
3837
- starting value is 1.0, which is the default.</dd>
3838
-
3839
- <dt>amount</dt>
3840
-
3841
- <dd>The percentage of the blurred image to be added to the
3842
- receiver, specified as a fraction between 0 and 1.0. A good
3843
- starting value is 1.0, which is the default.</dd>
3844
-
3845
- <dt>threshold</dt>
3846
-
3847
- <dd>The threshold needed to apply the amount, specified as a
3848
- fraction between 0 and 1.0. A good starting value is 0.05,
3849
- which is the default.</dd>
3850
- </dl>
3851
-
3852
- <h4>Returns</h4>
3853
-
3854
- <p>A new image</p>
3855
-
3856
- <h4>Example</h4>
3857
-
3858
- <p><a href=
3859
- "javascript:popup:('unsharp_mask.rb.html')"><img src="ex/unsharp_mask.jpg"
3860
- alt="unsharp_mask example" title=
3861
- "Click to see the example script" /></a></p>
3862
-
3863
- <h4>See also</h4>
3864
-
3865
- <p><a href="image2.html#enhance">enhance</a>, <a href=
3866
- "image2.html#median_filter">median_filter</a>, <a href=
3867
- "image3.html#reduce_noise">reduce_noise</a>, <a href=
3868
- "#unsharp_mask_channel">unsharp_mask_channel</a></p>
3869
-
3870
- <h4>Magick API</h4>
3871
-
3872
- <p>UnsharpMaskImage</p>
3873
- </div>
3874
-
3875
- <div class="sig">
3876
- <h3 id="unsharp_mask_channel">unsharp_mask_channel</h3>
3877
-
3878
- <p><span class=
3879
- "arg">img</span>.unsharp_mask_channel(<span class=
3880
- "arg">radius=0.0</span>, <span class="arg">sigma=1.0</span>,
3881
- <span class="arg">amount=1.0</span>, <span class=
3882
- "arg">threshold=0.05</span> [,<span class=
3883
- "arg">channel</span>...]) -&gt; <em>image</em></p>
3884
- </div>
3885
-
3886
- <div class="desc">
3887
- <h4>Description</h4>
3888
-
3889
- <p class="imquote">Sharpens an image. We convolve the image
3890
- with a Gaussian operator of the given <span class=
3891
- "arg">radius</span> and standard deviation (<span class=
3892
- "arg">sigma</span>). For reasonable results, <span class=
3893
- "arg">radius</span> should be larger than <span class=
3894
- "arg">sigma</span>. Use a radius of 0 and
3895
- <code>unsharp_mask_channel</code> selects a suitable radius for
3896
- you.</p>
3897
-
3898
- <p>Only the specified channels are sharpened.</p>
3899
-
3900
- <h4>Arguments</h4>
3901
-
3902
- <p>All arguments are optional.</p>
3903
-
3904
- <dl>
3905
- <dt>radius</dt>
3906
-
3907
- <dd>The radius of the Gaussian operator. The default is
3908
- 0.0.</dd>
3909
-
3910
- <dt>sigma</dt>
3911
-
3912
- <dd>The standard deviation of the Gaussian operator. A good
3913
- starting value is 1.0, which is the default.</dd>
3914
-
3915
- <dt>amount</dt>
3916
-
3917
- <dd>The percentage of the blurred image to be added to the
3918
- receiver, specified as a fraction between 0 and 1.0. A good
3919
- starting value is 1.0, which is the default.</dd>
3920
-
3921
- <dt>threshold</dt>
3922
-
3923
- <dd>The threshold needed to apply the amount, specified as a
3924
- fraction between 0 and 1.0. A good starting value is 0.05,
3925
- which is the default.</dd>
3926
-
3927
- <dt>channel...</dt>
3928
-
3929
- <dd>0 or more <a href=
3930
- "constants.html#ChannelType">ChannelType</a> arguments. If no
3931
- channels are specified, all the channels are sharpened. This
3932
- is the equivalent of <a href=
3933
- "#unsharp_mask">unsharp_mask</a>.</dd>
3934
- </dl>
3935
-
3936
- <h4>Returns</h4>
3937
-
3938
- <p>A new image</p>
3939
-
3940
- <h4>See also</h4>
3941
-
3942
- <p><a href="image2.html#enhance">enhance</a>, <a href=
3943
- "image2.html#median_filter">median_filter</a>, <a href=
3944
- "image3.html#reduce_noise">reduce_noise</a>, <a href=
3945
- "#unsharp_mask">unsharp_mask</a></p>
3946
-
3947
- <h4>Magick API</h4>
3948
-
3949
- <p>UnsharpMaskImageChannel</p>
3950
- </div>
3951
-
3952
- <div class="sig">
3953
- <h3 id="view">view</h3>
3954
-
3955
- <p><span class="arg">img</span>.view(<span class=
3956
- "arg">x</span>, <span class="arg">y</span>, <span class=
3957
- "arg">width</span>, <span class="arg">height</span>) -&gt;
3958
- <em>aView</em><br />
3959
- <span class="arg">img</span>.view(<span class="arg">x</span>,
3960
- <span class="arg">y</span>, <span class="arg">width</span>,
3961
- <span class="arg">height</span>) {&nbsp;|view|
3962
- <em>block</em>&nbsp;} -&gt; <em>nil</em></p>
3963
- </div>
3964
-
3965
- <div class="desc">
3966
- <h4>Description</h4><code>View</code> is a convenience method
3967
- that supports getting and setting individual image pixels by
3968
- <code>[i][j]</code> coordinates. With no associated block,
3969
- <code>view</code> returns an <a href=
3970
- "struct.html#view">Image::View</a> object. If the optional code
3971
- block is given, it will be passed the <code>Image::View</code>
3972
- object as an argument. The <a href=
3973
- "struct.html#view_sync">sync</a> method will be called
3974
- automatically when the block terminates. In this case,
3975
- <code>view</code> returns <code>nil</code>.
3976
-
3977
- <h4>Arguments</h4>
3978
-
3979
- <dl>
3980
- <dt>x, y</dt>
3981
-
3982
- <dd>The offset of the view from the top-left corner of the
3983
- image. Within the view, pixels are relative to the top-left
3984
- corner of the view, <em>not</em> the image.</dd>
3985
-
3986
- <dt>width, height</dt>
3987
-
3988
- <dd>The width and height of the view. The view may not extend
3989
- past the boundaries of <span class="arg">img</span>.</dd>
3990
- </dl>
3991
-
3992
- <h4>Returns</h4>
3993
-
3994
- <p>If the optional code block is present, <code>view</code>
3995
- returns <code>nil</code>. If it is not present,
3996
- <code>view</code> returns an <code>Image::View</code>
3997
- object.</p>
3998
-
3999
- <h4>See</h4>
4000
-
4001
- <p><a href="struct.html#view">Image::View</a></p>
4002
-
4003
- <h4>Examples</h4>
4004
-
4005
- <p>The example image below has been scaled 500% for
4006
- clarity.</p>
4007
-
4008
- <p><a href="javascript:popup('viewex.rb.html')"><img src=
4009
- "ex/viewex.gif" title="Click to see the example script" alt=
4010
- "view example" /></a></p>
4011
- <pre>
4012
- img = Image.new(40, 40) {self.background_color = 'lightcyan2'}
4013
-
4014
- # The view is 400 pixels square, starting at
4015
- # column 10, row 5 from the top of the image.
4016
- img.view( 10, 5, 20, 20) do |view|
4017
-
4018
- # Set all the pixels in the view to green.
4019
- view[][] = Pixel.new(0, QuantumRange)
4020
-
4021
- # Change the top and bottom rows to red.
4022
- view[0][] = 'red'
4023
- view[-1,1][] = 'red'
4024
-
4025
- # Set 6 pixels to black.
4026
- view[[13,15]][[12,14,16]] = 'black'
4027
-
4028
- # Set 1 pixel to yellow.
4029
- view[5][7] = 'yellow'
4030
-
4031
- # Change the green channel of all the
4032
- # pixels on row 8.
4033
- view[8][].green = QuantumRange/2
4034
-
4035
- # Change the blue channel of 8 pixels
4036
- # on column 10.
4037
- view[4,8][10].blue = QuantumRange
4038
- end
4039
- </pre>
4040
-
4041
- <h4>See also</h4>
4042
-
4043
- <p><a href="image3.html#pixel_color">pixel_color</a>, <a href=
4044
- "image2.html#get_pixels">get_pixels</a>, <a href=
4045
- "#store_pixels">store_pixels</a></p>
4046
-
4047
- <h4>Notes</h4>
4048
-
4049
- <p>The <code>view</code> method introduces a relatively high
4050
- level of overhead to pixel manipulation compared to methods
4051
- that use the ImageMagick API to identify and change pixels. I
4052
- recommend that you use <code>view</code> only when the number
4053
- of pixels identified in the view is fairly small (a few
4054
- thousand to a few hundred thousand, depending on your patience
4055
- and the speed of your computer) and you need this degree of
4056
- control.</p>
4057
- </div>
4058
-
4059
- <div class="sig">
4060
- <h3 id="vignette">vignette</h3>
4061
-
4062
- <p><span class="arg">img</span>.vignette(<span class=
4063
- "arg">x</span>, <span class="arg">y</span>, <span class=
4064
- "arg">radius</span>=0.0, <span class="arg">sigma</span>=10.0)
4065
- -&gt; <span class="arg">image</span></p>
4066
- </div>
4067
-
4068
- <div class="desc">
4069
- <h4>Description</h4>
4070
-
4071
- <p>Gradually shades the edges of the image by transforming the
4072
- pixels into the background color.</p>
4073
-
4074
- <h4>Arguments</h4>
4075
-
4076
- <dl>
4077
- <dt>x</dt>
4078
-
4079
- <dd>Influences the amount of background color in the
4080
- horizontal dimension. Larger values of <span class=
4081
- "arg">x</span> make the vignette narrower. This argument
4082
- should be positive and less than image.columns / 2. This
4083
- argument is optional. If omitted, the default value is 0.10 *
4084
- <span class="arg">img</span>.columns.</dd>
4085
-
4086
- <dt>y</dt>
4087
-
4088
- <dd>Influences the amount of background color in the vertical
4089
- dimension. Larger values of <span class="arg">y</span> make
4090
- the vignette shorter. This argument should be positive and
4091
- less than image.rows / 2. This argument is optional. If
4092
- omitted, the default value is 0.10 * <span class=
4093
- "arg">img</span>.rows.</dd>
4094
-
4095
- <dt>radius, sigma</dt>
4096
-
4097
- <dd>Controls the amount of blurring. Larger values of
4098
- <span class="arg">sigma</span> increase the blurring at the
4099
- expense of increased execution time. In general, <span class=
4100
- "arg">radius</span> should be larger than <span class=
4101
- "arg">sigma</span>, although if <span class=
4102
- "arg">radius</span> is 0 then ImageMagick will choose a
4103
- suitable value. <span class="arg">Sigma</span> must be
4104
- non-zero. Choose a very small value for <span class=
4105
- "arg">sigma</span> to produce a "hard" edge.</dd>
4106
- </dl>
4107
-
4108
- <h4>Returns</h4>
4109
-
4110
- <p>A new image</p>
4111
-
4112
- <h4>Example</h4>
4113
-
4114
- <p class="rollover"><a href=
4115
- "javascript:popup('vignette.rb.html')"><img src=
4116
- "ex/vignette.jpg" alt="vignette example" title=
4117
- "Click to see the example script" onmouseover=
4118
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
4119
- "this.src='ex/vignette.jpg'" /></a> <img src=
4120
- "ex/images/spin.gif" alt="" class="spin" title=
4121
- "Mouse over the example to see the original image" /></p>
4122
-
4123
- <h4>Magick API</h4>
4124
-
4125
- <p>VignetteImage</p>
4126
-
4127
- <h4>Notes</h4>
4128
-
4129
- <p>The image produced by <code>vignette</code> is very similar
4130
- to the image produced by RMagick's vignette.rb example script.
4131
- However, the example script gives you more control over the
4132
- size, shape, and background color of the vignette.</p>
4133
- </div>
4134
-
4135
- <div class="sig">
4136
- <h3 id="watermark">watermark</h3>
4137
-
4138
- <p><span class="arg">img</span>.watermark(<span class=
4139
- "arg">mark</span>, <span class="arg">lightness</span>=1.0,
4140
- <span class="arg">saturation</span>=1.0, <span class=
4141
- "arg">x_offset</span>=0, <span class="arg">y_offset</span>=0)
4142
- -&gt; <em>image</em><br />
4143
- <span class="arg">img</span>.watermark(<span class=
4144
- "arg">mark</span>, <span class="arg">lightness</span>=1.0,
4145
- <span class="arg">saturation</span>=1.0, <span class=
4146
- "arg">gravity</span>, <span class="arg">x_offset</span>=0,
4147
- <span class="arg">y_offset</span>=0) -&gt; <em>image</em></p>
4148
- </div>
4149
-
4150
- <div class="desc">
4151
- <h4>Description</h4>
4152
-
4153
- <p>Composites a watermark image on the target image using the
4154
- <a href="constants.html#CompositeOperator">Modulate</a>
4155
- composite operator. This composite operation operates in the
4156
- HSL colorspace and combines part of the lightness, part of the
4157
- saturation, and all of the hue of each pixel in the watermark
4158
- with the corresponding pixel in the target image</p>
4159
-
4160
- <h4>Arguments</h4>
4161
-
4162
- <dl>
4163
- <dt>mark</dt>
4164
-
4165
- <dd>The watermark image. Either an imagelist or an image. If
4166
- an imagelist, uses the current image.</dd>
4167
-
4168
- <dt>lightness</dt>
4169
-
4170
- <dd>The fraction of the lightness component of the watermark
4171
- pixels to be composited onto the target image. Must be a
4172
- non-negative number or a string in the form "NN%". If
4173
- lightness is a number it is interpreted as a percentage. Both
4174
- 0.25 and "25%" mean 25%. The default is 100%.</dd>
4175
-
4176
- <dt>saturation</dt>
4177
-
4178
- <dd>The fraction of the saturation component of the watermark
4179
- pixels to be composited onto the target image. Must be a
4180
- non-negative number or a string in the form "NN%". If
4181
- lightness is a number it is interpreted as a percentage. Both
4182
- 0.25 and "25%" mean 25%. The default is 100%.</dd>
4183
-
4184
- <dt>x_offset</dt>
4185
-
4186
- <dd>The offset of the watermark, measured from the left-hand
4187
- side of the target image. The default is 0.</dd>
4188
-
4189
- <dt>y_offset</dt>
4190
-
4191
- <dd>The offset of the watermark, measured from the top of the
4192
- target image. The default is 0.</dd>
4193
- </dl>
4194
-
4195
- <p>Watermark can be called with a <span class=
4196
- "arg">gravity</span> argument or without. When a <span class=
4197
- "arg">gravity</span> argument is specified but the <span class=
4198
- "arg">x-</span> and <span class="arg">y-offsets</span> are
4199
- omitted, the watermark is positioned based on the value of the
4200
- <span class="arg">gravity</span> argument:</p>
4201
-
4202
- <dl>
4203
- <dt>NorthWestGravity</dt>
4204
-
4205
- <dd>The watermark abuts the top and left sides of the
4206
- image.</dd>
4207
-
4208
- <dt>NorthGravity</dt>
4209
-
4210
- <dd>The watermark is centered left-to-right and abuts the top
4211
- of the image.</dd>
4212
-
4213
- <dt>NorthEastGravity</dt>
4214
-
4215
- <dd>The watermark abuts the top and right sides of the
4216
- image.</dd>
4217
-
4218
- <dt>EastGravity</dt>
4219
-
4220
- <dd>The watermark is centered top-to-bottom and abuts the
4221
- right side of the image.</dd>
4222
-
4223
- <dt>SouthEastGravity</dt>
4224
-
4225
- <dd>The watermark abuts the bottom and right sides of the
4226
- image.</dd>
4227
-
4228
- <dt>SouthGravity</dt>
4229
-
4230
- <dd>The watermark is centered left-to-right and abuts the
4231
- bottom of the image.</dd>
4232
-
4233
- <dt>SouthWestGravity</dt>
4234
-
4235
- <dd>The watermark abuts the bottom and left sides of the
4236
- image.</dd>
4237
-
4238
- <dt>WestGravity</dt>
4239
-
4240
- <dd>The watermark is centered top-to-bottom and abuts the
4241
- left side of the image.</dd>
4242
-
4243
- <dt>CenterGravity</dt>
4244
-
4245
- <dd>The watermark is centered left-to-right and
4246
- top-to-bottom.</dd>
4247
- </dl>
4248
-
4249
- <p>When the <span class="arg">gravity</span> argument is
4250
- present and the <span class="arg">x-offset</span> (and
4251
- optionally the <span class="arg">y-offset</span>) is present,
4252
- the <span class="arg">x-</span> and <span class=
4253
- "arg">y-offset</span> are measured from the right and/or bottom
4254
- edges of the target image based on the value of <span class=
4255
- "arg">gravity</span>. If the argument is NorthEastGravity,
4256
- EastGravity, or SouthEastGravity, the <span class=
4257
- "arg">x-offset</span> is measured from the right side of the
4258
- image. If the argument is SouthEastGravity, SouthGravity, or
4259
- SouthWestGravity, the <span class="arg">y-offset</span> is
4260
- measured from the bottom of the image. All other values are
4261
- ignored and the <span class="arg">x-</span> and <span class=
4262
- "arg">y-offset</span> are measured from the upper-left corner
4263
- of the image.</p>
4264
-
4265
- <h4>Returns</h4>
4266
-
4267
- <p>A new image</p>
4268
-
4269
- <h4>Example</h4>
4270
-
4271
- <p>See <a href=
4272
- "http://www.cit.gu.edu.au/~anthony/graphics/imagick6/annotating/#wmark_image">
4273
- "Watermarking with Images"</a> in Anthony Thyssen's <a href=
4274
- "http://www.cit.gu.edu.au/~anthony/graphics/imagick6/"><cite>Examples
4275
- of ImageMagick Usage</cite></a>.</p>
4276
-
4277
- <p class="rollover"><a href=
4278
- "javascript:popup('watermark.rb.html')"><img src=
4279
- "ex/watermark.jpg" alt="watermark example" title=
4280
- "Click to see the example script" onmouseover=
4281
- "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
4282
- "this.src='ex/watermark.jpg'" /></a> <img src=
4283
- "ex/images/spin.gif" alt="" class="spin" title=
4284
- "Mouse over the example to see the original image" /></p>
4285
-
4286
- <h4>See also</h4>
4287
-
4288
- <p><a href="image1.html#composite">composite</a>, <a href=
4289
- "#stegano">stegano</a></p>
4290
- </div>
4291
-
4292
- <div class="sig">
4293
- <h3 id="wave">wave</h3>
4294
-
4295
- <p><span class="arg">img</span>.wave(<span class=
4296
- "arg">amplitude</span>=25.0, <span class=
4297
- "arg">wavelength</span>=150.0) -&gt; <em>image</em></p>
4298
- </div>
4299
-
4300
- <div class="desc">
4301
- <h4>Description</h4>
4302
-
4303
- <p class="imquote">Creates a "ripple" effect in the image by
4304
- shifting the pixels vertically along a sine wave whose
4305
- <span class="arg">amplitude</span> and <span class=
4306
- "arg">wavelength</span> is specified by the given
4307
- parameters.</p>
4308
-
4309
- <h4>Returns</h4>
4310
-
4311
- <p>A new image</p>
4312
-
4313
- <h4>Example</h4>
4314
-
4315
- <p class="rollover"><a href="javascript:popup('wave.rb.html')">
4316
- <!-- This img tag displays the original image when the mouse is over -->
4317
- <img style=
4318
- "padding-top:25px; padding-bottom:25px; display:none" id=
4319
- "nowave" title="Click to see the example script" onmouseout=
4320
- "this.style.display='none'; waved.style.display='';" src=
4321
- "ex/images/Flower_Hat.jpg" alt="wave example" /> <!--
4322
- This img tag displays the framed image when the mouse is not over
4323
- --><img class="hide"
4324
- id="waved" onmouseover=
4325
- "this.style.display='none'; nowave.style.display='';" src=
4326
- "ex/wave.jpg" alt="wave example" /></a> <img src=
4327
- "ex/images/spin.gif" alt="" class="spin" title=
4328
- "Mouse over the example to see the original image" /></p>
4329
-
4330
- <h4>Magick API</h4>
4331
-
4332
- <p>WaveImage</p>
4333
-
4334
- <h4>See also</h4>
4335
-
4336
- <p><a href=
4337
- "imageattrs.html#virtual_pixel_method">virtual_pixel_method</a></p>
4338
- </div>
4339
-
4340
- <div class="sig">
4341
- <h3 id="wet_floor">wet_floor</h3>
4342
-
4343
- <p><span class="arg">img</span>.wet_floor(<span class=
4344
- "arg">initial=0.5</span>, <span class="arg">rate=1.0</span>)
4345
- -&gt; <em>image</em></p>
4346
- </div>
4347
-
4348
- <div class="desc">
4349
- <h4>Description</h4>
4350
-
4351
- <p>Creates a <a href=
4352
- "http://en.wikipedia.org/wiki/Wet_floor_effect">"wet floor"</a>
4353
- reflection. The reflection is an inverted copy of the image
4354
- that changes from partially transparent to entirely
4355
- transparent. By default only the bottom third of the image
4356
- appears in the reflection.</p>
4357
-
4358
- <p>Note that the output image is just the reflection. This
4359
- makes it easy to apply further transformations to the
4360
- reflection before combining it with the original image.</p>
4361
-
4362
- <h4>Arguments</h4>
4363
-
4364
- <dl>
4365
- <dt>initial</dt>
4366
-
4367
- <dd>A value between 0.0 and 1.0 that specifies the initial
4368
- percentage of transparency. Higher values cause the top of
4369
- the reflection to be more transparent, lower values less
4370
- transparent. The default is 0.5, which means that the top of
4371
- the reflection is 50% transparent.</dd>
4372
-
4373
- <dt>rate</dt>
4374
-
4375
- <dd>A non-negative value that specifies how rapidly the
4376
- reflection transitions from the initial level of transparency
4377
- to entirely transparent. The default value is 1.0, which
4378
- means that the transition occurs in 1/3 the image height.
4379
- Values greater than 1.0 speed up the transition (the
4380
- reflection will have fewer rows), values lower than 1.0 slow
4381
- down the transition (the reflection will have more rows). A
4382
- value of 0.0 means that the level of transparency will not
4383
- change.</dd>
4384
- </dl>
4385
-
4386
- <h4>Returns</h4>
4387
-
4388
- <p>A new image</p>
4389
-
4390
- <h4>Example</h4>
4391
-
4392
- <p>Here are four examples of <code>wet_floor</code>. The top
4393
- image shows the result of appending the default reflection to
4394
- the original image. The second image shows the result of
4395
- decreasing the initial transparency to 0.25 and using 0.5 as
4396
- the <span class="arg">rate</span> argument. The third image
4397
- uses the same reflection as the second image but has a slant
4398
- added. The bottom image is the same as the third image but with
4399
- a ripple effect.</p>
4400
-
4401
- <p><a href="javascript:popup('wet_floor.rb.html')"><img src=
4402
- "ex/wet_floor.gif" title="Click to see the example script" alt=
4403
- "wet floor example" /></a></p>
4404
- </div>
4405
-
4406
- <div class="sig">
4407
- <h3 id="white_threshold">white_threshold</h3>
4408
-
4409
- <p><span class="arg">img</span>.white_threshold(<span class=
4410
- "arg">red_channel</span> [, <span class=
4411
- "arg">green_channel</span>[, <span class=
4412
- "arg">blue_channel</span>[, <span class=
4413
- "arg">opacity_channel</span>]]]) -&gt; <em>image</em></p>
4414
- </div>
4415
-
4416
- <div class="desc">
4417
- <h4>Description</h4>
4418
-
4419
- <p class="imquote">Forces all pixels above the threshold into
4420
- white while leaving all pixels below the threshold
4421
- unchanged.</p>
4422
-
4423
- <h4>Arguments</h4>
4424
-
4425
- <p>Each channel argument is a number between 0 and
4426
- QuantumRange. All arguments except the first may be omitted. If
4427
- the <span class="arg">green_channel</span> or <span class=
4428
- "arg">blue_channel</span> argument is omitted, the default
4429
- value is the <span class="arg">red_channel</span> value. If the
4430
- <span class="arg">opacity_channel</span> argument is omitted,
4431
- the default value is <a href=
4432
- "constants.html#Opacity">OpaqueOpacity</a>.</p>
4433
-
4434
- <h4>Returns</h4>
4435
-
4436
- <p>A new image</p>
4437
-
4438
- <h4>See also</h4>
4439
-
4440
- <p><a href="image1.html#black_threshold">black_threshold</a>,
4441
- <a href="image1.html#bilevel_channel">bilevel_channel</a></p>
4442
-
4443
- <h4>Magick API</h4>
4444
-
4445
- <p>WhiteThresholdImage</p>
4446
- </div>
4447
-
4448
- <div class="sig">
4449
- <h3 id="write">write</h3>
4450
-
4451
- <p><span class="arg">img</span>.write(<span class=
4452
- "arg">filename</span>) <span class="arg">[ { optional arguments
4453
- } ]</span> -&gt; <em>self</em><br />
4454
- <span class="arg">img</span>.write(<span class=
4455
- "arg">file</span>) <span class="arg">[ { optional arguments }
4456
- ]</span> -&gt; <em>self</em></p>
4457
- </div>
4458
-
4459
- <div class="desc">
4460
- <h4>Description</h4>
4461
-
4462
- <p>Writes the image to the specified file. ImageMagick
4463
- determines image format from the <a href=
4464
- "imusage.html#formats">prefix or extension</a>.</p>
4465
-
4466
- <p>If the argument is an open file, ImageMagick will write the
4467
- image in its current format. You can force a different format
4468
- by setting the image's <a href=
4469
- "imageattrs.html#Image.format">format</a> attribute.</p>
4470
-
4471
- <h4>Arguments</h4>
4472
-
4473
- <p>A file name or open file object. You may also specify
4474
- optional arguments by setting <a href=
4475
- "info.html">Image::Info</a> attributes in an associated
4476
- block.</p>
4477
-
4478
- <h4>Returns</h4>
4479
-
4480
- <p><code>self</code>, or <code>nil</code> if the image format
4481
- cannot be determined.</p>
4482
-
4483
- <h4>Example</h4>
4484
-
4485
- <p>Almost all of the examples call <code>write</code>.</p>
4486
-
4487
- <h4>Notes</h4>
4488
-
4489
- <p>When the argument is a filename, specify the output format
4490
- via the filename extension (for example ".jpg" or ".gif") or by
4491
- prefixing the filename with the desired format (for example,
4492
- "jpeg:myfile"), not via <code>format=</code>.</p>
4493
-
4494
- <p><em>Do not</em> use a StringIO object or a Tempfile object
4495
- as the argument. Neither of these work. Use
4496
- <code>to_blob</code> to write to a String. Instead of a
4497
- tempfile, get the path of the tempfile from the
4498
- <code>path</code> method. Prefix the path with the desired
4499
- image format. For example,</p>
4500
- <pre>
4501
- temp = Tempfile.new("image")
4502
- img.write("jpeg:"+ temp.path)
4503
- </pre>
4504
-
4505
- <h4>See also</h4>
4506
-
4507
- <p><a href="ilist.html#write">ImageList#write</a></p>
4508
-
4509
- <h4>Magick API</h4>
4510
-
4511
- <p>WriteImage</p>
4512
- </div>
4513
-
4514
- <p class="spacer">&nbsp;</p>
4515
-
4516
- <div class="nav">
4517
- &laquo;&nbsp;<a href="image2.html">Prev</a> | <a href=
4518
- "index.html">Contents</a> | <a href=
4519
- "draw.html">Next</a>&nbsp;&raquo;
4520
- </div>
4521
- </body>
4522
- </html>