rmagick-windows 2.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +14 -0
- data/.gitignore +23 -0
- data/.hound.yml +2 -0
- data/.rspec +1 -0
- data/.rubocop.yml +340 -0
- data/.simplecov +27 -0
- data/.travis.yml +60 -0
- data/CHANGELOG.md +915 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +50 -0
- data/Doxyfile +1514 -0
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/README.textile +257 -0
- data/Rakefile +188 -0
- data/before_install_linux.sh +32 -0
- data/before_install_osx.sh +2 -0
- data/deprecated/RMagick.rb +6 -0
- data/doc/.cvsignore +1 -0
- data/doc/comtasks.html +287 -0
- data/doc/constants.html +1581 -0
- data/doc/css/doc.css +299 -0
- data/doc/css/popup.css +34 -0
- data/doc/css/ref.css +67 -0
- data/doc/draw.html +3272 -0
- data/doc/ex/InitialCoords.rb +22 -0
- data/doc/ex/NewCoordSys.rb +30 -0
- data/doc/ex/OrigCoordSys.rb +16 -0
- data/doc/ex/PreserveAspectRatio.rb +204 -0
- data/doc/ex/RotateScale.rb +36 -0
- data/doc/ex/Skew.rb +38 -0
- data/doc/ex/Use01.rb +15 -0
- data/doc/ex/Use02.rb +20 -0
- data/doc/ex/Use03.rb +16 -0
- data/doc/ex/ViewBox.rb +31 -0
- data/doc/ex/adaptive_threshold.rb +9 -0
- data/doc/ex/add_noise.rb +16 -0
- data/doc/ex/affine.rb +48 -0
- data/doc/ex/affine_transform.rb +20 -0
- data/doc/ex/arc.rb +49 -0
- data/doc/ex/arcpath.rb +32 -0
- data/doc/ex/arcs01.rb +28 -0
- data/doc/ex/arcs02.rb +59 -0
- data/doc/ex/average.rb +15 -0
- data/doc/ex/axes.rb +64 -0
- data/doc/ex/baseline_shift01.rb +17 -0
- data/doc/ex/bilevel_channel.rb +8 -0
- data/doc/ex/blur_image.rb +12 -0
- data/doc/ex/border.rb +10 -0
- data/doc/ex/bounding_box.rb +42 -0
- data/doc/ex/cbezier1.rb +41 -0
- data/doc/ex/cbezier2.rb +41 -0
- data/doc/ex/cbezier3.rb +41 -0
- data/doc/ex/cbezier4.rb +42 -0
- data/doc/ex/cbezier5.rb +42 -0
- data/doc/ex/cbezier6.rb +53 -0
- data/doc/ex/channel.rb +25 -0
- data/doc/ex/charcoal.rb +12 -0
- data/doc/ex/chop.rb +29 -0
- data/doc/ex/circle.rb +33 -0
- data/doc/ex/circle01.rb +16 -0
- data/doc/ex/clip_path.rb +60 -0
- data/doc/ex/coalesce.rb +57 -0
- data/doc/ex/color_fill_to_border.rb +29 -0
- data/doc/ex/color_floodfill.rb +28 -0
- data/doc/ex/color_histogram.rb +47 -0
- data/doc/ex/color_reset.rb +11 -0
- data/doc/ex/colorize.rb +16 -0
- data/doc/ex/colors.rb +64 -0
- data/doc/ex/compose_mask.rb +22 -0
- data/doc/ex/composite.rb +133 -0
- data/doc/ex/composite_layers.rb +53 -0
- data/doc/ex/composite_tiled.rb +21 -0
- data/doc/ex/contrast.rb +36 -0
- data/doc/ex/crop.rb +31 -0
- data/doc/ex/crop_with_gravity.rb +42 -0
- data/doc/ex/cubic01.rb +43 -0
- data/doc/ex/cubic02.rb +91 -0
- data/doc/ex/cycle_colormap.rb +21 -0
- data/doc/ex/dissolve.rb +12 -0
- data/doc/ex/drawcomp.rb +42 -0
- data/doc/ex/drop_shadow.rb +60 -0
- data/doc/ex/edge.rb +11 -0
- data/doc/ex/ellipse.rb +45 -0
- data/doc/ex/ellipse01.rb +21 -0
- data/doc/ex/emboss.rb +11 -0
- data/doc/ex/enhance.rb +28 -0
- data/doc/ex/equalize.rb +11 -0
- data/doc/ex/evenodd.rb +42 -0
- data/doc/ex/fill_pattern.rb +23 -0
- data/doc/ex/flatten_images.rb +36 -0
- data/doc/ex/flip.rb +11 -0
- data/doc/ex/flop.rb +11 -0
- data/doc/ex/font_styles.rb +32 -0
- data/doc/ex/fonts.rb +20 -0
- data/doc/ex/frame.rb +12 -0
- data/doc/ex/gaussian_blur.rb +11 -0
- data/doc/ex/get_multiline_type_metrics.rb +41 -0
- data/doc/ex/get_pixels.rb +47 -0
- data/doc/ex/get_type_metrics.rb +141 -0
- data/doc/ex/gradientfill.rb +27 -0
- data/doc/ex/grav.rb +45 -0
- data/doc/ex/gravity.rb +80 -0
- data/doc/ex/group.rb +26 -0
- data/doc/ex/hatchfill.rb +27 -0
- data/doc/ex/image.rb +44 -0
- data/doc/ex/images/Apple.miff +0 -0
- data/doc/ex/images/Ballerina.jpg +0 -0
- data/doc/ex/images/Ballerina3.jpg +0 -0
- data/doc/ex/images/Button_0.gif +0 -0
- data/doc/ex/images/Button_1.gif +0 -0
- data/doc/ex/images/Button_2.gif +0 -0
- data/doc/ex/images/Button_3.gif +0 -0
- data/doc/ex/images/Button_4.gif +0 -0
- data/doc/ex/images/Button_5.gif +0 -0
- data/doc/ex/images/Button_6.gif +0 -0
- data/doc/ex/images/Button_7.gif +0 -0
- data/doc/ex/images/Button_8.gif +0 -0
- data/doc/ex/images/Button_9.gif +0 -0
- data/doc/ex/images/Button_A.gif +0 -0
- data/doc/ex/images/Button_B.gif +0 -0
- data/doc/ex/images/Button_C.gif +0 -0
- data/doc/ex/images/Button_D.gif +0 -0
- data/doc/ex/images/Button_E.gif +0 -0
- data/doc/ex/images/Button_F.gif +0 -0
- data/doc/ex/images/Button_G.gif +0 -0
- data/doc/ex/images/Button_H.gif +0 -0
- data/doc/ex/images/Button_I.gif +0 -0
- data/doc/ex/images/Button_J.gif +0 -0
- data/doc/ex/images/Button_K.gif +0 -0
- data/doc/ex/images/Button_L.gif +0 -0
- data/doc/ex/images/Button_M.gif +0 -0
- data/doc/ex/images/Button_N.gif +0 -0
- data/doc/ex/images/Button_O.gif +0 -0
- data/doc/ex/images/Button_P.gif +0 -0
- data/doc/ex/images/Button_Q.gif +0 -0
- data/doc/ex/images/Button_R.gif +0 -0
- data/doc/ex/images/Button_S.gif +0 -0
- data/doc/ex/images/Button_T.gif +0 -0
- data/doc/ex/images/Button_U.gif +0 -0
- data/doc/ex/images/Button_V.gif +0 -0
- data/doc/ex/images/Button_W.gif +0 -0
- data/doc/ex/images/Button_X.gif +0 -0
- data/doc/ex/images/Button_Y.gif +0 -0
- data/doc/ex/images/Button_Z.gif +0 -0
- data/doc/ex/images/Cheetah.jpg +0 -0
- data/doc/ex/images/Coffee.wmf +0 -0
- data/doc/ex/images/Flower_Hat.jpg +0 -0
- data/doc/ex/images/Gold_Statue.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
- data/doc/ex/images/Leaf.miff +0 -0
- data/doc/ex/images/No.wmf +0 -0
- data/doc/ex/images/Polynesia.jpg +0 -0
- data/doc/ex/images/Red_Rocks.jpg +0 -0
- data/doc/ex/images/Rocks_On_Beach.miff +0 -0
- data/doc/ex/images/Shorts.jpg +0 -0
- data/doc/ex/images/Snake.wmf +0 -0
- data/doc/ex/images/Violin.jpg +0 -0
- data/doc/ex/images/Yellow_Rose.miff +0 -0
- data/doc/ex/images/big-duck.gif +0 -0
- data/doc/ex/images/duck.gif +0 -0
- data/doc/ex/images/duck0.gif +0 -0
- data/doc/ex/images/duck1.gif +0 -0
- data/doc/ex/images/duck10.gif +0 -0
- data/doc/ex/images/duck11.gif +0 -0
- data/doc/ex/images/duck12.gif +0 -0
- data/doc/ex/images/duck13.gif +0 -0
- data/doc/ex/images/duck14.gif +0 -0
- data/doc/ex/images/duck15.gif +0 -0
- data/doc/ex/images/duck2.gif +0 -0
- data/doc/ex/images/duck3.gif +0 -0
- data/doc/ex/images/duck4.gif +0 -0
- data/doc/ex/images/duck5.gif +0 -0
- data/doc/ex/images/duck6.gif +0 -0
- data/doc/ex/images/duck7.gif +0 -0
- data/doc/ex/images/duck8.gif +0 -0
- data/doc/ex/images/duck9.gif +0 -0
- data/doc/ex/images/graydient230x6.gif +0 -0
- data/doc/ex/images/image_with_profile.jpg +0 -0
- data/doc/ex/images/logo400x83.gif +0 -0
- data/doc/ex/images/model.miff +0 -0
- data/doc/ex/images/notimplemented.gif +0 -0
- data/doc/ex/images/smile.miff +0 -0
- data/doc/ex/images/spin.gif +0 -0
- data/doc/ex/implode.rb +34 -0
- data/doc/ex/level.rb +11 -0
- data/doc/ex/level_colors.rb +11 -0
- data/doc/ex/line.rb +41 -0
- data/doc/ex/line01.rb +21 -0
- data/doc/ex/mask.rb +35 -0
- data/doc/ex/matte_fill_to_border.rb +39 -0
- data/doc/ex/matte_floodfill.rb +32 -0
- data/doc/ex/matte_replace.rb +39 -0
- data/doc/ex/median_filter.rb +28 -0
- data/doc/ex/modulate.rb +11 -0
- data/doc/ex/mono.rb +23 -0
- data/doc/ex/morph.rb +25 -0
- data/doc/ex/mosaic.rb +35 -0
- data/doc/ex/motion_blur.rb +11 -0
- data/doc/ex/negate.rb +11 -0
- data/doc/ex/negate_channel.rb +9 -0
- data/doc/ex/nested_rvg.rb +21 -0
- data/doc/ex/nonzero.rb +42 -0
- data/doc/ex/normalize.rb +11 -0
- data/doc/ex/oil_paint.rb +11 -0
- data/doc/ex/opacity.rb +37 -0
- data/doc/ex/ordered_dither.rb +11 -0
- data/doc/ex/path.rb +63 -0
- data/doc/ex/pattern1.rb +25 -0
- data/doc/ex/pattern2.rb +26 -0
- data/doc/ex/polaroid.rb +27 -0
- data/doc/ex/polygon.rb +23 -0
- data/doc/ex/polygon01.rb +21 -0
- data/doc/ex/polyline.rb +22 -0
- data/doc/ex/polyline01.rb +21 -0
- data/doc/ex/posterize.rb +8 -0
- data/doc/ex/preview.rb +8 -0
- data/doc/ex/qbezierpath.rb +52 -0
- data/doc/ex/quad01.rb +34 -0
- data/doc/ex/quantize-m.rb +25 -0
- data/doc/ex/radial_blur.rb +9 -0
- data/doc/ex/raise.rb +8 -0
- data/doc/ex/random_threshold_channel.rb +13 -0
- data/doc/ex/rect01.rb +14 -0
- data/doc/ex/rect02.rb +20 -0
- data/doc/ex/rectangle.rb +34 -0
- data/doc/ex/reduce_noise.rb +28 -0
- data/doc/ex/remap.rb +11 -0
- data/doc/ex/remap_images.rb +19 -0
- data/doc/ex/resize_to_fill.rb +8 -0
- data/doc/ex/resize_to_fit.rb +8 -0
- data/doc/ex/roll.rb +9 -0
- data/doc/ex/rotate.rb +44 -0
- data/doc/ex/rotate_f.rb +14 -0
- data/doc/ex/roundrect.rb +33 -0
- data/doc/ex/rubyname.rb +30 -0
- data/doc/ex/rvg_clippath.rb +12 -0
- data/doc/ex/rvg_linecap.rb +42 -0
- data/doc/ex/rvg_linejoin.rb +40 -0
- data/doc/ex/rvg_opacity.rb +18 -0
- data/doc/ex/rvg_pattern.rb +26 -0
- data/doc/ex/rvg_stroke_dasharray.rb +11 -0
- data/doc/ex/segment.rb +11 -0
- data/doc/ex/sepiatone.rb +7 -0
- data/doc/ex/shade.rb +11 -0
- data/doc/ex/shadow.rb +30 -0
- data/doc/ex/shave.rb +15 -0
- data/doc/ex/shear.rb +10 -0
- data/doc/ex/sketch.rb +17 -0
- data/doc/ex/skewx.rb +51 -0
- data/doc/ex/skewy.rb +47 -0
- data/doc/ex/smile.rb +125 -0
- data/doc/ex/solarize.rb +11 -0
- data/doc/ex/sparse_color.rb +54 -0
- data/doc/ex/splice.rb +8 -0
- data/doc/ex/spread.rb +11 -0
- data/doc/ex/stegano.rb +55 -0
- data/doc/ex/stroke_dasharray.rb +42 -0
- data/doc/ex/stroke_fill.rb +10 -0
- data/doc/ex/stroke_linecap.rb +44 -0
- data/doc/ex/stroke_linejoin.rb +48 -0
- data/doc/ex/stroke_width.rb +49 -0
- data/doc/ex/swirl.rb +17 -0
- data/doc/ex/text.rb +37 -0
- data/doc/ex/text01.rb +16 -0
- data/doc/ex/text_align.rb +36 -0
- data/doc/ex/text_antialias.rb +37 -0
- data/doc/ex/text_styles.rb +19 -0
- data/doc/ex/text_undercolor.rb +28 -0
- data/doc/ex/texture_fill_to_border.rb +34 -0
- data/doc/ex/texture_floodfill.rb +32 -0
- data/doc/ex/texturefill.rb +24 -0
- data/doc/ex/threshold.rb +13 -0
- data/doc/ex/to_blob.rb +13 -0
- data/doc/ex/translate.rb +39 -0
- data/doc/ex/transparent.rb +38 -0
- data/doc/ex/transpose.rb +9 -0
- data/doc/ex/transverse.rb +9 -0
- data/doc/ex/tref01.rb +24 -0
- data/doc/ex/triangle01.rb +15 -0
- data/doc/ex/trim.rb +23 -0
- data/doc/ex/tspan01.rb +17 -0
- data/doc/ex/tspan02.rb +17 -0
- data/doc/ex/tspan03.rb +19 -0
- data/doc/ex/unsharp_mask.rb +28 -0
- data/doc/ex/viewex.rb +33 -0
- data/doc/ex/vignette.rb +12 -0
- data/doc/ex/watermark.rb +27 -0
- data/doc/ex/wave.rb +9 -0
- data/doc/ex/wet_floor.rb +58 -0
- data/doc/ex/writing_mode01.rb +26 -0
- data/doc/ex/writing_mode02.rb +26 -0
- data/doc/ilist.html +2056 -0
- data/doc/image1.html +4680 -0
- data/doc/image2.html +3665 -0
- data/doc/image3.html +4522 -0
- data/doc/imageattrs.html +1638 -0
- data/doc/imusage.html +514 -0
- data/doc/index.html +416 -0
- data/doc/info.html +1499 -0
- data/doc/magick.html +565 -0
- data/doc/optequiv.html +2435 -0
- data/doc/rvg.html +975 -0
- data/doc/rvgclip.html +248 -0
- data/doc/rvggroup.html +305 -0
- data/doc/rvgimage.html +289 -0
- data/doc/rvgpattern.html +475 -0
- data/doc/rvgshape.html +406 -0
- data/doc/rvgstyle.html +270 -0
- data/doc/rvgtext.html +465 -0
- data/doc/rvgtspan.html +238 -0
- data/doc/rvgtut.html +530 -0
- data/doc/rvguse.html +145 -0
- data/doc/rvgxform.html +294 -0
- data/doc/scripts/doc.js +22 -0
- data/doc/scripts/stripeTables.js +23 -0
- data/doc/struct.html +1339 -0
- data/doc/usage.html +1621 -0
- data/examples/constitute.rb +7 -0
- data/examples/crop_with_gravity.rb +42 -0
- data/examples/demo.rb +324 -0
- data/examples/describe.rb +43 -0
- data/examples/find_similar_region.rb +34 -0
- data/examples/histogram.rb +321 -0
- data/examples/identify.rb +185 -0
- data/examples/image_opacity.rb +29 -0
- data/examples/import_export.rb +31 -0
- data/examples/pattern_fill.rb +38 -0
- data/examples/rotating_text.rb +44 -0
- data/examples/spinner.rb +49 -0
- data/examples/thumbnail.rb +64 -0
- data/examples/vignette.rb +78 -0
- data/ext/RMagick/extconf.rb +548 -0
- data/ext/RMagick/rmagick.c +401 -0
- data/ext/RMagick/rmagick.h +1287 -0
- data/ext/RMagick/rmdraw.c +2022 -0
- data/ext/RMagick/rmenum.c +1235 -0
- data/ext/RMagick/rmfill.c +720 -0
- data/ext/RMagick/rmilist.c +1270 -0
- data/ext/RMagick/rmimage.c +15427 -0
- data/ext/RMagick/rminfo.c +2590 -0
- data/ext/RMagick/rmmain.c +1741 -0
- data/ext/RMagick/rmmontage.c +519 -0
- data/ext/RMagick/rmpixel.c +1114 -0
- data/ext/RMagick/rmstruct.c +1124 -0
- data/ext/RMagick/rmutil.c +1754 -0
- data/lib/rmagick.rb +1 -0
- data/lib/rmagick/version.rb +6 -0
- data/lib/rmagick_internal.rb +1947 -0
- data/lib/rvg/clippath.rb +45 -0
- data/lib/rvg/container.rb +122 -0
- data/lib/rvg/deep_equal.rb +52 -0
- data/lib/rvg/describable.rb +47 -0
- data/lib/rvg/embellishable.rb +391 -0
- data/lib/rvg/misc.rb +723 -0
- data/lib/rvg/paint.rb +50 -0
- data/lib/rvg/pathdata.rb +126 -0
- data/lib/rvg/rvg.rb +283 -0
- data/lib/rvg/stretchable.rb +165 -0
- data/lib/rvg/stylable.rb +116 -0
- data/lib/rvg/text.rb +172 -0
- data/lib/rvg/transformable.rb +126 -0
- data/lib/rvg/units.rb +63 -0
- data/rmagick.gemspec +46 -0
- data/spec/rmagick/ImageList1_spec.rb +24 -0
- data/spec/rmagick/draw_spec.rb +156 -0
- data/spec/rmagick/image/blue_shift_spec.rb +16 -0
- data/spec/rmagick/image/composite_spec.rb +140 -0
- data/spec/rmagick/image/constitute_spec.rb +15 -0
- data/spec/rmagick/image/dispatch_spec.rb +18 -0
- data/spec/rmagick/image/from_blob_spec.rb +14 -0
- data/spec/rmagick/image/ping_spec.rb +14 -0
- data/spec/rmagick/image/properties_spec.rb +29 -0
- data/spec/spec_helper.rb +4 -0
- data/test/Image1.rb +565 -0
- data/test/Image2.rb +1304 -0
- data/test/Image3.rb +1030 -0
- data/test/ImageList1.rb +806 -0
- data/test/ImageList2.rb +385 -0
- data/test/Image_attributes.rb +697 -0
- data/test/Import_Export.rb +121 -0
- data/test/Info.rb +345 -0
- data/test/Magick.rb +321 -0
- data/test/Pixel.rb +116 -0
- data/test/Preview.rb +57 -0
- data/test/cmyk.icm +0 -0
- data/test/srgb.icm +0 -0
- data/test/test_all_basic.rb +38 -0
- data/test/tmpnam_test.rb +50 -0
- data/wercker.yml +10 -0
- metadata +509 -0
data/doc/image1.html
ADDED
@@ -0,0 +1,4680 @@
|
|
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 (class methods and instance
|
10
|
+
methods a-d)</title>
|
11
|
+
<meta http-equiv="Content-Type" content=
|
12
|
+
"text/html; charset=us-ascii" />
|
13
|
+
<meta name="GENERATOR" content="Quanta Plus" />
|
14
|
+
<meta name="Copyright" content=
|
15
|
+
"Copyright (C) 2006 by Timothy P. Hunter" />
|
16
|
+
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
17
|
+
<script type="text/javascript" src="scripts/doc.js">
|
18
|
+
</script>
|
19
|
+
<script type="text/javascript">
|
20
|
+
//<![CDATA[
|
21
|
+
<!-- Pre-load this image so that the browser knows how big it is. -->
|
22
|
+
flower_hat = new Image();
|
23
|
+
flower_hat.src = "ex/images/Flower_Hat.jpg";
|
24
|
+
function show_noise(type)
|
25
|
+
{
|
26
|
+
if (type == null)
|
27
|
+
{
|
28
|
+
document.getElementById("add_noise_example").src = "ex/images/Flower_Hat.jpg";
|
29
|
+
}
|
30
|
+
else
|
31
|
+
{
|
32
|
+
document.getElementById("add_noise_example").src = "ex/add_noise_" + type + ".jpg";
|
33
|
+
}
|
34
|
+
}
|
35
|
+
//]]>
|
36
|
+
</script>
|
37
|
+
<style type="text/css">
|
38
|
+
/*<![CDATA[*/
|
39
|
+
.noise_example_wrapper img {
|
40
|
+
float: left;
|
41
|
+
}
|
42
|
+
.noise_example_wrapper p, .noise_example_wrapper ul {
|
43
|
+
margin-left: 4px;
|
44
|
+
float: left;
|
45
|
+
}
|
46
|
+
/*]]>*/
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
|
52
|
+
|
53
|
+
<div class="nav">
|
54
|
+
« <a href="imageattrs.html">Prev</a> | <a href=
|
55
|
+
"index.html">Contents</a> | <a href=
|
56
|
+
"image2.html">Next</a> »
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<h1>class Image <span class="superclass">< Object</span>
|
60
|
+
(class methods and instance methods a-d)<br />
|
61
|
+
<span class="mixin">mixes in Comparable</span></h1>
|
62
|
+
|
63
|
+
<div id="toc">
|
64
|
+
<h2>Table of Contents</h2>
|
65
|
+
|
66
|
+
<h3>class methods</h3>
|
67
|
+
|
68
|
+
<div>
|
69
|
+
<div class="toccol">
|
70
|
+
<ul>
|
71
|
+
<li><a href="#capture">capture</a></li>
|
72
|
+
|
73
|
+
<li><a href="#combine">combine</a></li>
|
74
|
+
|
75
|
+
<li><a href="#constitute">constitute</a></li>
|
76
|
+
</ul>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="toccol">
|
80
|
+
<ul>
|
81
|
+
<li><a href="#from_blob">from_blob</a></li>
|
82
|
+
|
83
|
+
<li><a href="#new">new</a></li>
|
84
|
+
|
85
|
+
<li><a href="#ping">ping</a></li>
|
86
|
+
</ul>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<div class="toccol">
|
90
|
+
<ul>
|
91
|
+
<li><a href="#read">read</a></li>
|
92
|
+
|
93
|
+
<li><a href="#read_inline">read_inline</a></li>
|
94
|
+
</ul>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<h3>instance methods</h3>
|
99
|
+
|
100
|
+
<div>
|
101
|
+
<div class="toccol">
|
102
|
+
<ul>
|
103
|
+
<li><a href="#aref">[ ]</a></li>
|
104
|
+
|
105
|
+
<li><a href="#aset">[ ]=</a></li>
|
106
|
+
|
107
|
+
<li><a href="#spaceship"><=></a></li>
|
108
|
+
|
109
|
+
<li><a href="#adaptive_blur">adaptive_blur</a></li>
|
110
|
+
|
111
|
+
<li><a href=
|
112
|
+
"#adaptive_blur_channel">adaptive_blur_channel</a></li>
|
113
|
+
|
114
|
+
<li><a href="#adaptive_resize">adaptive_resize</a></li>
|
115
|
+
|
116
|
+
<li><a href="#adaptive_sharpen">adaptive_sharpen</a></li>
|
117
|
+
|
118
|
+
<li><a href=
|
119
|
+
"#adaptive_sharpen_channel">adaptive_sharpen_channel</a></li>
|
120
|
+
|
121
|
+
<li><a href=
|
122
|
+
"#adaptive_threshold">adaptive_threshold</a></li>
|
123
|
+
|
124
|
+
<li><a href="#add_compose_mask">add_compose_mask</a></li>
|
125
|
+
|
126
|
+
<li><a href="#add_noise">add_noise</a></li>
|
127
|
+
|
128
|
+
<li><a href=
|
129
|
+
"#add_noise_channel">add_noise_channel</a></li>
|
130
|
+
|
131
|
+
<li><a href="#add_profile">add_profile</a></li>
|
132
|
+
|
133
|
+
<li><a href="#affine_transform">affine_transform</a></li>
|
134
|
+
|
135
|
+
<li><a href="#alpha">alpha</a></li>
|
136
|
+
|
137
|
+
<li><a href="#alpha_q">alpha?</a></li>
|
138
|
+
|
139
|
+
<li><a href="#annotate">annotate</a></li>
|
140
|
+
|
141
|
+
<li><a href=
|
142
|
+
"#auto_gamma_channel">auto_gamma_channel</a></li>
|
143
|
+
|
144
|
+
<li><a href=
|
145
|
+
"#auto_level_channel">auto_level_channel</a></li>
|
146
|
+
|
147
|
+
<li><a href="#auto_orient">auto_orient</a></li>
|
148
|
+
|
149
|
+
<li><a href="#auto_orient_bang">auto_orient!</a></li>
|
150
|
+
|
151
|
+
<li><a href="#bilevel_channel">bilevel_channel</a></li>
|
152
|
+
|
153
|
+
<li><a href="#black_threshold">black_threshold</a></li>
|
154
|
+
|
155
|
+
<li><a href="#blend">blend</a></li>
|
156
|
+
|
157
|
+
<li><a href="#blue_shift">blue_shift</a></li>
|
158
|
+
|
159
|
+
<li><a href="#blur_channel">blur_channel</a></li>
|
160
|
+
|
161
|
+
<li><a href="#blur_image">blur_image</a></li>
|
162
|
+
</ul>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
<div class="toccol">
|
166
|
+
<ul>
|
167
|
+
<li><a href="#border">border</a></li>
|
168
|
+
|
169
|
+
<li><a href="#border_bang">border!</a></li>
|
170
|
+
|
171
|
+
<li><a href="#bounding_box">bounding_box</a></li>
|
172
|
+
|
173
|
+
<li><a href="#change_geometry">change_geometry</a></li>
|
174
|
+
|
175
|
+
<li><a href="#changed_q">changed?</a></li>
|
176
|
+
|
177
|
+
<li><a href="#channel">channel</a></li>
|
178
|
+
|
179
|
+
<li><a href="#channel_depth">channel_depth</a></li>
|
180
|
+
|
181
|
+
<li><a href="#channel_extrema">channel_extrema</a></li>
|
182
|
+
|
183
|
+
<li><a href="#channel_mean">channel_mean</a></li>
|
184
|
+
|
185
|
+
<li><a href="#charcoal">charcoal</a></li>
|
186
|
+
|
187
|
+
<li><a href="#check_destroyed">check_destroyed</a></li>
|
188
|
+
|
189
|
+
<li><a href="#chop">chop</a></li>
|
190
|
+
|
191
|
+
<li><a href="#clone">clone</a></li>
|
192
|
+
|
193
|
+
<li><a href="#clut_channel">clut_channel</a></li>
|
194
|
+
|
195
|
+
<li><a href=
|
196
|
+
"#color_fill_to_border">color_fill_to_border</a></li>
|
197
|
+
|
198
|
+
<li><a href="#color_floodfill">color_floodfill</a></li>
|
199
|
+
|
200
|
+
<li><a href="#color_histogram">color_histogram</a></li>
|
201
|
+
|
202
|
+
<li><a href="#colorize">colorize</a></li>
|
203
|
+
|
204
|
+
<li><a href="#colormap">colormap</a></li>
|
205
|
+
|
206
|
+
<li><a href="#color_point">color_point</a></li>
|
207
|
+
|
208
|
+
<li><a href="#color_reset_bang">color_reset!</a></li>
|
209
|
+
|
210
|
+
<li><a href="#compare_channel">compare_channel</a></li>
|
211
|
+
|
212
|
+
<li><a href="#composite">composite</a></li>
|
213
|
+
|
214
|
+
<li><a href="#composite_bang">composite!</a></li>
|
215
|
+
|
216
|
+
<li><a href="#composite_affine">composite_affine</a></li>
|
217
|
+
|
218
|
+
<li><a href=
|
219
|
+
"#composite_mathematics">composite_mathematics</a></li>
|
220
|
+
|
221
|
+
<li><a href="#composite_tiled">composite_tiled</a></li>
|
222
|
+
</ul>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div class="toccol">
|
226
|
+
<ul>
|
227
|
+
<li><a href=
|
228
|
+
"#composite_tiled_bang">composite_tiled!</a></li>
|
229
|
+
|
230
|
+
<li><a href=
|
231
|
+
"#compress_colormap_bang">compress_colormap!</a></li>
|
232
|
+
|
233
|
+
<li><a href="#contrast">contrast</a></li>
|
234
|
+
|
235
|
+
<li><a href=
|
236
|
+
"#contrast_stretch_channel">contrast_stretch_channel</a></li>
|
237
|
+
|
238
|
+
<li><a href="#convolve">convolve</a></li>
|
239
|
+
|
240
|
+
<li><a href="#convolve_channel">convolve_channel</a></li>
|
241
|
+
|
242
|
+
<li><a href="#copy">copy</a></li>
|
243
|
+
|
244
|
+
<li><a href="#crop">crop</a></li>
|
245
|
+
|
246
|
+
<li><a href="#crop_bang">crop!</a></li>
|
247
|
+
|
248
|
+
<li><a href="#crop_resized">crop_resized</a></li>
|
249
|
+
|
250
|
+
<li><a href="#cycle_colormap">cycle_colormap</a></li>
|
251
|
+
|
252
|
+
<li><a href="#decipher">decipher</a></li>
|
253
|
+
|
254
|
+
<li><a href=
|
255
|
+
"#delete_compose_mask">delete_compose_mask</a></li>
|
256
|
+
|
257
|
+
<li><a href="#delete_profile">delete_profile</a></li>
|
258
|
+
|
259
|
+
<li><a href="#deskew">deskew</a></li>
|
260
|
+
|
261
|
+
<li><a href="#despeckle">despeckle</a></li>
|
262
|
+
|
263
|
+
<li><a href="#destroy_bang">destroy!</a></li>
|
264
|
+
|
265
|
+
<li><a href="#destroyed_q">destroyed?</a></li>
|
266
|
+
|
267
|
+
<li><a href="#difference">difference</a></li>
|
268
|
+
|
269
|
+
<li><a href="#dispatch">dispatch</a></li>
|
270
|
+
|
271
|
+
<li><a href="#displace">displace</a></li>
|
272
|
+
|
273
|
+
<li><a href="#display">display</a></li>
|
274
|
+
|
275
|
+
<li><a href="#dissolve">dissolve</a></li>
|
276
|
+
|
277
|
+
<li><a href="#distort">distort</a></li>
|
278
|
+
|
279
|
+
<li><a href=
|
280
|
+
"#distortion_channel">distortion_channel</a></li>
|
281
|
+
|
282
|
+
<li><a href="#dup">dup</a></li>
|
283
|
+
</ul>
|
284
|
+
</div>
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<h2 class="methods">class methods</h2>
|
289
|
+
|
290
|
+
<div class="sig">
|
291
|
+
<h3 id="capture">capture</h3>
|
292
|
+
|
293
|
+
<p>Image.capture(<span class=
|
294
|
+
"arg">silent=</span><code>false</code>, <span class=
|
295
|
+
"arg">frame=</span><code>false</code>, <span class=
|
296
|
+
"arg">descend=</span><code>false</code>, <span class=
|
297
|
+
"arg">screen=</span><code>false</code>, <span class=
|
298
|
+
"arg">borders=</span><code>false</code>) [ <span class=
|
299
|
+
"arg">{ optional arguments }</span> ] ->
|
300
|
+
<em>image</em></p>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div class="desc">
|
304
|
+
<h4>Description</h4>
|
305
|
+
|
306
|
+
<p>Reads an image from an X window. Unless you identify a
|
307
|
+
window to capture via the <em>optional arguments</em> block,
|
308
|
+
when <code>capture</code> is invoked the cursor will turn into
|
309
|
+
a cross. Click the cursor on the window to be captured.</p>
|
310
|
+
|
311
|
+
<p>Within the optional arguments block, specify
|
312
|
+
<code>self.filename = "root"</code> to capture the entire
|
313
|
+
desktop. To programatically specify the window to be captured,
|
314
|
+
use <code>self.filename = window_id</code>, where window_id is
|
315
|
+
the id displayed by xwininfo(1).</p>
|
316
|
+
|
317
|
+
<h4>Arguments</h4>
|
318
|
+
|
319
|
+
<dl>
|
320
|
+
<dt>silent</dt>
|
321
|
+
|
322
|
+
<dd>If <code>true</code>, suppress the beeps that signal the
|
323
|
+
start and finish of the capture process. The bell rings once
|
324
|
+
to signal the start of the capture and twice to signal the
|
325
|
+
finish.</dd>
|
326
|
+
|
327
|
+
<dt>frame</dt>
|
328
|
+
|
329
|
+
<dd>If <code>true</code>, include the window frame.</dd>
|
330
|
+
|
331
|
+
<dt>descend</dt>
|
332
|
+
|
333
|
+
<dd>If <code>true</code>, <span class="imquote">obtain image
|
334
|
+
by descending window hierarchy.</span></dd>
|
335
|
+
|
336
|
+
<dt>screen</dt>
|
337
|
+
|
338
|
+
<dd>If <code>true</code>, specifies that <span class=
|
339
|
+
"imquote">the GetImage request used to obtain the image
|
340
|
+
should be done on the root window, rather than directly on
|
341
|
+
the specified window. In this way, you can obtain pieces of
|
342
|
+
other windows that overlap the specified window, and more
|
343
|
+
importantly, you can capture menus or other popups that are
|
344
|
+
independent windows but appear over the specified
|
345
|
+
window.</span></dd>
|
346
|
+
|
347
|
+
<dt>borders</dt>
|
348
|
+
|
349
|
+
<dd>If <code>true</code>, include the border in the
|
350
|
+
image.</dd>
|
351
|
+
|
352
|
+
<dt>optional arguments</dt>
|
353
|
+
|
354
|
+
<dd>You can specify any of these Image::Info attributes in
|
355
|
+
the <em>optional arguments</em> block: <a href=
|
356
|
+
"info.html#colorspace">colorspace</a>, <a href=
|
357
|
+
"info.html#depth">depth</a>, <a href=
|
358
|
+
"info.html#dither">dither</a>, <a href=
|
359
|
+
"info.html#interlace">interlace</a>, and <a href=
|
360
|
+
"info.html#type">type</a>.</dd>
|
361
|
+
</dl>
|
362
|
+
|
363
|
+
<h4>Returns</h4>
|
364
|
+
|
365
|
+
<p>A new image.</p>
|
366
|
+
|
367
|
+
<h4>Example</h4>
|
368
|
+
<pre>
|
369
|
+
img = Image.capture {
|
370
|
+
self.filename = "root"
|
371
|
+
}
|
372
|
+
</pre>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
<div class="sig">
|
376
|
+
<h3 id="combine">combine</h3>
|
377
|
+
|
378
|
+
<p>Image.combine(<span class="arg">red_ch</span>=nil,
|
379
|
+
<span class="arg">green_ch</span>=nil, <span class=
|
380
|
+
"arg">blue_ch</span>=nil<span class="arg">,
|
381
|
+
opacity_ch</span>=nil) -><em>image</em></p>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
<div class="desc">
|
385
|
+
<h4>Description</h4>
|
386
|
+
|
387
|
+
<p>Combines the grayscale value of the pixels in each image to
|
388
|
+
form a new image.</p>
|
389
|
+
|
390
|
+
<h4>Arguments</h4>
|
391
|
+
|
392
|
+
<p>The red channel of the image specified in the first argument
|
393
|
+
is used as the red channel in the new image. The green channel
|
394
|
+
of the image specified in the second argument is used as the
|
395
|
+
green channel in the new image. The blue channel of the image
|
396
|
+
specified in the third argument is used as the blue channel in
|
397
|
+
the new image. The opacity channel of the image specified in
|
398
|
+
the fourth argument is used as the opacity channel in the new
|
399
|
+
image.</p>
|
400
|
+
|
401
|
+
<p>Any of the arguments may be nil. Trailing nil arguments may
|
402
|
+
be omitted. You must specify at least one image argument.</p>
|
403
|
+
|
404
|
+
<h4>Returns</h4>
|
405
|
+
|
406
|
+
<p>A new image</p>
|
407
|
+
|
408
|
+
<h4>See also</h4>
|
409
|
+
|
410
|
+
<p>The same results can be obtained using the <a href=
|
411
|
+
"#composite">composite</a> method and the
|
412
|
+
CopyRed/Green/Blue/OpacityCompositeOp <a href=
|
413
|
+
"constants.html#CompositeOperator">CompositeOperator</a> enum
|
414
|
+
values.</p>
|
415
|
+
|
416
|
+
<h4>Magick API</h4>
|
417
|
+
|
418
|
+
<p>CombineImages</p>
|
419
|
+
</div>
|
420
|
+
|
421
|
+
<div class="sig">
|
422
|
+
<h3 id="constitute">constitute</h3>
|
423
|
+
|
424
|
+
<p>Image.constitute(<span class="arg">width</span>,
|
425
|
+
<span class="arg">height</span>, <span class="arg">map</span>,
|
426
|
+
<span class="arg">pixels</span>) -> <em>image</em></p>
|
427
|
+
</div>
|
428
|
+
|
429
|
+
<div class="desc">
|
430
|
+
<h4>Description</h4>
|
431
|
+
|
432
|
+
<p>Creates an image from an array of pixels. This method is the
|
433
|
+
reverse of <a href="#dispatch"><code>dispatch</code></a>.</p>
|
434
|
+
|
435
|
+
<h4>Arguments</h4>
|
436
|
+
|
437
|
+
<dl>
|
438
|
+
<dt>width</dt>
|
439
|
+
|
440
|
+
<dd>The number of columns in the image</dd>
|
441
|
+
|
442
|
+
<dt>height</dt>
|
443
|
+
|
444
|
+
<dd>The number of rows in the image</dd>
|
445
|
+
|
446
|
+
<dt>map</dt>
|
447
|
+
|
448
|
+
<dd>A string describing <span class="imquote">the expected
|
449
|
+
ordering of the pixel array. It can be any combination or
|
450
|
+
order of R = red, G = green, B = blue, A = alpha, C = cyan, Y
|
451
|
+
= yellow, M = magenta, K = black, or I = intensity (for
|
452
|
+
grayscale).</span></dd>
|
453
|
+
|
454
|
+
<dt>pixels</dt>
|
455
|
+
|
456
|
+
<dd>The pixel data. The pixel data in the array must be
|
457
|
+
stored in scanline order, left-to-right and top-to-bottom.
|
458
|
+
The elements in the array must be either all
|
459
|
+
<code>Integers</code> or all <code>Floats</code>. If the
|
460
|
+
elements are <code>Integers</code>, the <code>Integers</code>
|
461
|
+
must be in the range [0..QuantumRange]. If the elements are
|
462
|
+
<code>Floats</code>, they must be in the range [0..1].</dd>
|
463
|
+
</dl>
|
464
|
+
|
465
|
+
<h4>Returns</h4>
|
466
|
+
|
467
|
+
<p>An image constructed from the pixel data.</p>
|
468
|
+
|
469
|
+
<h4>Example</h4>
|
470
|
+
<pre>
|
471
|
+
image = Image.constitute(width, height, "RGB", pixels)
|
472
|
+
</pre>
|
473
|
+
|
474
|
+
<h4>See also</h4>
|
475
|
+
|
476
|
+
<p><a href=
|
477
|
+
"image2.html#import_pixels"><code>import_pixels</code></a>,
|
478
|
+
<a href=
|
479
|
+
"image3.html#store_pixels"><code>store_pixels</code></a></p>
|
480
|
+
|
481
|
+
<h4>Magick API</h4>
|
482
|
+
|
483
|
+
<p>ConstituteImage</p>
|
484
|
+
</div>
|
485
|
+
|
486
|
+
<div class="sig">
|
487
|
+
<h3 id="from_blob">from_blob</h3>
|
488
|
+
|
489
|
+
<p>Image.from_blob(<span class="arg">string</span>) [
|
490
|
+
<span class="arg">{ optional arguments }</span> ] ->
|
491
|
+
<em>array</em></p>
|
492
|
+
</div>
|
493
|
+
|
494
|
+
<div class="desc">
|
495
|
+
<h4>Description</h4>
|
496
|
+
|
497
|
+
<p>Creates an array of images from a BLOB, that is, a
|
498
|
+
<em>B</em>inary <em>L</em>arge <em>OB</em>ject. In RMagick, a
|
499
|
+
BLOB is a string.</p>
|
500
|
+
|
501
|
+
<h4>Arguments</h4>
|
502
|
+
|
503
|
+
<p>A blob can be a string containing an image file such as a
|
504
|
+
JPEG or GIF. The string can contain a multi-image file such as
|
505
|
+
an animated GIF or a Photoshop image with multiple layers. A
|
506
|
+
blob can also be one of the strings produced by <a href=
|
507
|
+
"image3.html#to_blob">to_blob</a>. Control the format of the
|
508
|
+
created image(s) by setting additional <a href=
|
509
|
+
"info.html">Image::Info</a> attributes in the optional block
|
510
|
+
argument.</p>
|
511
|
+
|
512
|
+
<h4>Returns</h4>
|
513
|
+
|
514
|
+
<p>An array of one or more images constructed from the
|
515
|
+
BLOB.</p>
|
516
|
+
|
517
|
+
<h4>Example</h4>
|
518
|
+
|
519
|
+
<p>See <a href=
|
520
|
+
"image3.html#to_blob"><code>to_blob</code></a>.</p>
|
521
|
+
|
522
|
+
<h4>Magick API</h4>
|
523
|
+
|
524
|
+
<p>BlobToImage</p>
|
525
|
+
</div>
|
526
|
+
|
527
|
+
<div class="sig">
|
528
|
+
<h3 id="new">new</h3>
|
529
|
+
|
530
|
+
<p>Image.new(<span class="arg">columns</span>, <span class=
|
531
|
+
"arg">rows</span> [, <span class="arg">fill</span>]) [
|
532
|
+
<span class="arg">{ optional arguments }</span> ] ->
|
533
|
+
<em>image</em></p>
|
534
|
+
</div>
|
535
|
+
|
536
|
+
<div class="desc">
|
537
|
+
<h4>Description</h4>Creates a new instance with the specified
|
538
|
+
number of columns and rows. You can specify other arguments by
|
539
|
+
setting <a href="info.html">Image::Info</a> attributes in the
|
540
|
+
optional block. If the optional <span class="arg">fill</span>
|
541
|
+
argument is not specified, the image is set to the background
|
542
|
+
color.
|
543
|
+
|
544
|
+
<h4>Arguments</h4>
|
545
|
+
|
546
|
+
<dl>
|
547
|
+
<dt>columns</dt>
|
548
|
+
|
549
|
+
<dd>The number of columns</dd>
|
550
|
+
|
551
|
+
<dt>rows</dt>
|
552
|
+
|
553
|
+
<dd>The number of rows</dd>
|
554
|
+
|
555
|
+
<dt>fill</dt>
|
556
|
+
|
557
|
+
<dd>A <a href="struct.html#fill"><code>Fill</code></a>
|
558
|
+
object</dd>
|
559
|
+
</dl>
|
560
|
+
|
561
|
+
<h4>Returns</h4>
|
562
|
+
|
563
|
+
<p>A new image.</p>
|
564
|
+
|
565
|
+
<h4>Example</h4>
|
566
|
+
<pre>
|
567
|
+
img = Image.new(256, 64) {
|
568
|
+
self.background_color = 'red'
|
569
|
+
}
|
570
|
+
</pre>
|
571
|
+
|
572
|
+
<h4>See also</h4>
|
573
|
+
|
574
|
+
<p><a href=
|
575
|
+
"ilist.html#new_image"><code>ImageList.new_image</code></a></p>
|
576
|
+
|
577
|
+
<h4>Magick API</h4>
|
578
|
+
|
579
|
+
<p>AllocateImage</p>
|
580
|
+
</div>
|
581
|
+
|
582
|
+
<div class="sig">
|
583
|
+
<h3 id="ping">ping</h3>
|
584
|
+
|
585
|
+
<p>Image.ping(<span class="arg">filename</span>) [ <span class=
|
586
|
+
"arg">{ optional arguments }</span> ] ->
|
587
|
+
<em>array</em><br />
|
588
|
+
Image.ping(<span class="arg">file</span>) [ <span class="arg">{
|
589
|
+
optional arguments }</span> ] -> <em>array</em></p>
|
590
|
+
</div>
|
591
|
+
|
592
|
+
<div class="desc">
|
593
|
+
<h4>Description</h4>
|
594
|
+
|
595
|
+
<p>Creates one or more images from the image file, omitting the
|
596
|
+
pixel data. Only the attributes are stored in the images. This
|
597
|
+
method is faster than <code><a href="#read">read</a></code> and
|
598
|
+
uses less memory.</p>
|
599
|
+
|
600
|
+
<h4>Arguments</h4>
|
601
|
+
|
602
|
+
<p>An image file name or open file object. You can specify
|
603
|
+
other arguments by setting <a href="info.html">Image::Info</a>
|
604
|
+
attributes in the optional block.</p>
|
605
|
+
|
606
|
+
<h4>Returns</h4>
|
607
|
+
|
608
|
+
<p>An array containing 0 or more images.</p>
|
609
|
+
|
610
|
+
<h4>Example</h4>
|
611
|
+
<pre>
|
612
|
+
cheetah = Image.ping("Cheetah.jpg") »
|
613
|
+
[Cheetah.jpg JPEG 1024x768 DirectClass 8-bit 101684b]
|
614
|
+
p cheetah[0].rows » 768
|
615
|
+
p cheetah[0].columns » 1024
|
616
|
+
</pre>
|
617
|
+
|
618
|
+
<h4>See also</h4>
|
619
|
+
|
620
|
+
<p><a href="#read"><code>read</code></a></p>
|
621
|
+
|
622
|
+
<h4>Magick API</h4>
|
623
|
+
|
624
|
+
<p>PingImage</p>
|
625
|
+
</div>
|
626
|
+
|
627
|
+
<div class="sig">
|
628
|
+
<h3 id="read">read</h3>
|
629
|
+
|
630
|
+
<p>Image.read(<span class="arg">filename</span>) [ <span class=
|
631
|
+
"arg">{ optional arguments }</span> ] ->
|
632
|
+
<em>array</em><br />
|
633
|
+
Image.read(<span class="arg">file</span>) [ <span class="arg">{
|
634
|
+
optional arguments }</span> ] -> <em>array</em></p>
|
635
|
+
</div>
|
636
|
+
|
637
|
+
<div class="desc">
|
638
|
+
<h4>Description</h4>
|
639
|
+
|
640
|
+
<p>Reads all the images from the specified file.</p>
|
641
|
+
|
642
|
+
<p><span style="font-style:italic">Note:</span> Because an
|
643
|
+
image file can contain multiple images or multiple image
|
644
|
+
layers, <code>read</code> always returns an array containing 0
|
645
|
+
or more elements, one element for each image or image layer in
|
646
|
+
the file.</p>
|
647
|
+
|
648
|
+
<h4>Arguments</h4>
|
649
|
+
|
650
|
+
<p>An image file name or open file object. You can specify
|
651
|
+
other arguments by setting <a href="info.html">Image::Info</a>
|
652
|
+
attributes in the optional block.</p>
|
653
|
+
|
654
|
+
<h4>Returns</h4>
|
655
|
+
|
656
|
+
<p>An array containing 0 or more Image objects. If the file is
|
657
|
+
a multi-image file such as an animated GIF or a Photoshop PSD
|
658
|
+
file with multiple layers, the array contains an Image object
|
659
|
+
for each image or layer in the file.</p>
|
660
|
+
|
661
|
+
<h4>Example</h4>
|
662
|
+
<pre>
|
663
|
+
animated = Image.read("animated.gif") »
|
664
|
+
[animated.gif GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b
|
665
|
+
animated.gif[1] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b,
|
666
|
+
animated.gif[2] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b]
|
667
|
+
</pre>
|
668
|
+
|
669
|
+
<h4>See also</h4>
|
670
|
+
|
671
|
+
<p><a href="#ping"><code>ping</code></a></p>
|
672
|
+
|
673
|
+
<h4>Note</h4>
|
674
|
+
|
675
|
+
<p>The read method does not accept a StringIO object. If you
|
676
|
+
want to create an image from a string buffer, use <a href=
|
677
|
+
"image1.html#from_blob">from_blob</a>.</p>
|
678
|
+
|
679
|
+
<h4>Magick API</h4>
|
680
|
+
|
681
|
+
<p>ReadImage</p>
|
682
|
+
</div>
|
683
|
+
|
684
|
+
<div class="sig">
|
685
|
+
<h3 id="read_inline">read_inline</h3>
|
686
|
+
|
687
|
+
<p>Image.read_inline(<span class="arg">content</span>) [
|
688
|
+
<span class="arg">{ optional arguments }</span> ] ->
|
689
|
+
<em>array</em></p>
|
690
|
+
</div>
|
691
|
+
|
692
|
+
<div class="desc">
|
693
|
+
<h4>Description</h4>
|
694
|
+
|
695
|
+
<p>Converts a Base64-encoded image or multi-image sequence to
|
696
|
+
an array of Image objects.</p>
|
697
|
+
|
698
|
+
<h4>Arguments</h4>
|
699
|
+
|
700
|
+
<p>A Base64-encoded string. Generally no optional arguments are
|
701
|
+
required. If the image format cannot be deduced from the image
|
702
|
+
data, you can use the <a href="info.html#format">format</a>
|
703
|
+
attribute. If you want to extract a subset of an image
|
704
|
+
sequence, see <a href="imusage.html#frames">here</a>.</p>
|
705
|
+
|
706
|
+
<h4>Returns</h4>
|
707
|
+
|
708
|
+
<p>An array containing 0 or more Image objects. If the content
|
709
|
+
is a multi-image sequence such as an animated GIF or a
|
710
|
+
Photoshop PSD file with multiple layers, the array contains an
|
711
|
+
Image object for each image or layer in the file.</p>
|
712
|
+
|
713
|
+
<h4>Example</h4>
|
714
|
+
<pre>
|
715
|
+
content = "R0lGODlhnAEuAferAAAAAAcIBggJBgw..."
|
716
|
+
img = Image.read_inline(content)
|
717
|
+
</pre>
|
718
|
+
|
719
|
+
<h4>See also</h4>
|
720
|
+
|
721
|
+
<p><a href="#read"><code>read</code></a></p>
|
722
|
+
</div>
|
723
|
+
|
724
|
+
<h2 class="methods">instance methods</h2>
|
725
|
+
|
726
|
+
<div class="sig">
|
727
|
+
<h3 id="aref">[ ]</h3>
|
728
|
+
|
729
|
+
<p><span class="arg">img</span>[<span class="arg">key</span>]
|
730
|
+
-> <em>string</em></p>
|
731
|
+
</div>
|
732
|
+
|
733
|
+
<div class="desc">
|
734
|
+
<h4>Description</h4>
|
735
|
+
|
736
|
+
<p>Returns the value of the image property identified by
|
737
|
+
<span class="arg">key</span>. An image may have any number of
|
738
|
+
properties. Each property is identified by a string (or symbol)
|
739
|
+
key. The property value is a string. ImageMagick predefines
|
740
|
+
some properties, including <code>Label</code>,
|
741
|
+
<code>Comment</code>, <code>Signature</code>, and in some cases
|
742
|
+
<code>EXIF</code>.</p>
|
743
|
+
|
744
|
+
<h4>Arguments</h4>The key may be a <code>String</code> or a
|
745
|
+
<code>Symbol</code>.
|
746
|
+
|
747
|
+
<h4>Returns</h4>
|
748
|
+
|
749
|
+
<p>The value of the property.</p>
|
750
|
+
|
751
|
+
<h4>Example</h4>
|
752
|
+
<pre>
|
753
|
+
mom['Label'] = 'My Mother'
|
754
|
+
</pre>
|
755
|
+
|
756
|
+
<h4>See also</h4>
|
757
|
+
|
758
|
+
<p><a href="#aset"><code>[ ]=</code></a>, <a href=
|
759
|
+
"image3.html#properties"><code>properties</code></a></p>
|
760
|
+
|
761
|
+
<h4>Magick API</h4>
|
762
|
+
|
763
|
+
<p>GetImageAttribute</p>
|
764
|
+
|
765
|
+
<h4>Note</h4>
|
766
|
+
|
767
|
+
<p>ImageMagick calls properties "attributes." I use the word
|
768
|
+
"properties" to reduce the confusion with image object
|
769
|
+
attributes such as <code>rows</code> and
|
770
|
+
<code>columns</code>.</p>
|
771
|
+
</div>
|
772
|
+
|
773
|
+
<div class="sig">
|
774
|
+
<h3 id="aset">[ ]=</h3>
|
775
|
+
|
776
|
+
<p><span class="arg">img</span>[<span class="arg">key</span>] =
|
777
|
+
<span class="arg">string</span> -> <em>self</em></p>
|
778
|
+
</div>
|
779
|
+
|
780
|
+
<div class="desc">
|
781
|
+
<h4>Description</h4>
|
782
|
+
|
783
|
+
<p>Sets the value of an image property. An image may have any
|
784
|
+
number of properties.</p>
|
785
|
+
|
786
|
+
<h4>Arguments</h4>The <span class="arg">key</span> may be a
|
787
|
+
string or a symbol. The value can be any string.
|
788
|
+
|
789
|
+
<h4>Returns</h4><code>self</code>
|
790
|
+
|
791
|
+
<h4>Example</h4>See <a href=
|
792
|
+
"javascript:popup('demo.rb.html')">demo.rb</a> for an example
|
793
|
+
of the use of the Label property.
|
794
|
+
|
795
|
+
<h4>See also</h4>
|
796
|
+
|
797
|
+
<p><a href="#aref">[<code> ]</code></a>, <a href=
|
798
|
+
"image3.html#properties"><code>properties</code></a></p>
|
799
|
+
|
800
|
+
<h4>Magick API</h4>
|
801
|
+
|
802
|
+
<p>SetImageAttribute</p>
|
803
|
+
</div>
|
804
|
+
|
805
|
+
<div class="sig">
|
806
|
+
<h3 id="spaceship"><=></h3>
|
807
|
+
|
808
|
+
<p><span class="arg">img</span> <=> <span class=
|
809
|
+
"arg">other_image</span> -> -1, 0, 1</p>
|
810
|
+
</div>
|
811
|
+
|
812
|
+
<div class="desc">
|
813
|
+
<h4>Description</h4>
|
814
|
+
|
815
|
+
<p>Compares two images and returns -1, 0, or 1 if <span class=
|
816
|
+
"arg">img</span> is less than, equal to, or greater than
|
817
|
+
<span class="arg">other_image</span> as determined by comparing
|
818
|
+
the signatures of the images. If one of the arguments is not an
|
819
|
+
image, this method raises a TypeError exception (in Ruby 1.6)
|
820
|
+
or returns <code>nil</code> (in Ruby 1.8)</p>
|
821
|
+
|
822
|
+
<p>In addition to <=>, <code>Image</code> mixes in the
|
823
|
+
<code>Comparable</code> module, which defines the <, <=,
|
824
|
+
== >=, >, and <code>between?</code> methods.</p>
|
825
|
+
|
826
|
+
<p>The <code>difference</code> method compares images (for
|
827
|
+
equality only) but also returns information about the amount
|
828
|
+
two images differ, which may be more useful.</p>
|
829
|
+
|
830
|
+
<h4>Returns</h4>
|
831
|
+
|
832
|
+
<p>The value of <span class=
|
833
|
+
"arg">img</span>.<code>signature</code> <=> <span class=
|
834
|
+
"arg">other_image</span>.<code>signature</code>.</p>
|
835
|
+
|
836
|
+
<h4>See also</h4>
|
837
|
+
|
838
|
+
<p><a href="image3.html#signature">signature</a>, <a href=
|
839
|
+
"#difference">difference</a>, <a href=
|
840
|
+
"#compare_channel">compare_channel</a></p>
|
841
|
+
|
842
|
+
<h4>Magick API</h4>
|
843
|
+
|
844
|
+
<p>SignatureImage</p>
|
845
|
+
</div>
|
846
|
+
|
847
|
+
<div class="sig">
|
848
|
+
<h3 id="adaptive_blur">adaptive_blur</h3>
|
849
|
+
|
850
|
+
<p><span class="arg">img</span>.adaptive_blur(<span class=
|
851
|
+
"arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0)
|
852
|
+
-> <em>image</em></p>
|
853
|
+
</div>
|
854
|
+
|
855
|
+
<div class="desc">
|
856
|
+
<h4>Description</h4>
|
857
|
+
|
858
|
+
<p><span class="imquote">Adaptively blurs the image by blurring
|
859
|
+
more intensely near image edges and less intensely far from
|
860
|
+
edges.</span> The adaptive_blur method blurs <span class=
|
861
|
+
"imquote">the image with a Gaussian operator of the
|
862
|
+
given</span> <span class="arg">radius</span> <span class=
|
863
|
+
"imquote">and standard deviation</span> (<span class=
|
864
|
+
"arg">sigma</span>). <span class="imquote">For reasonable
|
865
|
+
results,</span> <span class="arg">radius</span> <span class=
|
866
|
+
"imquote">should be larger than</span> <span class=
|
867
|
+
"arg">sigma</span>. <span class="imquote">Use a</span>
|
868
|
+
<span class="arg">radius</span> <span class="imquote">of 0 and
|
869
|
+
adaptive_blur selects a suitable</span> <span class=
|
870
|
+
"arg">radius</span> <span class="imquote">for you.</span></p>
|
871
|
+
|
872
|
+
<h4>Arguments</h4>
|
873
|
+
|
874
|
+
<dl>
|
875
|
+
<dt>radius</dt>
|
876
|
+
|
877
|
+
<dd><span class="imquote">The radius of the Gaussian in
|
878
|
+
pixels, not counting the center pixel.</span> The default is
|
879
|
+
0.0.</dd>
|
880
|
+
|
881
|
+
<dt>sigma</dt>
|
882
|
+
|
883
|
+
<dd><span class="imquote">The standard deviation of the
|
884
|
+
Laplacian, in pixels.</span> The default is 1.0.</dd>
|
885
|
+
</dl>
|
886
|
+
|
887
|
+
<h4>Returns</h4>
|
888
|
+
|
889
|
+
<p>A new image</p>
|
890
|
+
|
891
|
+
<h4>See also</h4>
|
892
|
+
|
893
|
+
<p><a href=
|
894
|
+
"#adaptive_blur_channel">adaptive_blur_channel</a></p>
|
895
|
+
|
896
|
+
<h4>Magick API</h4>
|
897
|
+
|
898
|
+
<p>AdaptiveBlurImage</p>
|
899
|
+
</div>
|
900
|
+
|
901
|
+
<div class="sig">
|
902
|
+
<h3 id="adaptive_blur_channel">adaptive_blur_channel</h3>
|
903
|
+
|
904
|
+
<p><span class="arg">img</span>.adaptive_blur(<span class=
|
905
|
+
"arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0
|
906
|
+
[,<span class="arg">channel</span>...]) ->
|
907
|
+
<em>image</em></p>
|
908
|
+
</div>
|
909
|
+
|
910
|
+
<div class="desc">
|
911
|
+
<h4>Description</h4>
|
912
|
+
|
913
|
+
<p>The same as <code>adaptive_blur</code> except only the
|
914
|
+
specified channels are blurred.</p>
|
915
|
+
|
916
|
+
<h4>Arguments</h4>
|
917
|
+
|
918
|
+
<dl>
|
919
|
+
<dt>radius</dt>
|
920
|
+
|
921
|
+
<dd><span class="imquote">The radius of the Gaussian in
|
922
|
+
pixels, not counting the center pixel.</span> The default is
|
923
|
+
0.0.</dd>
|
924
|
+
|
925
|
+
<dt>sigma</dt>
|
926
|
+
|
927
|
+
<dd><span class="imquote">The standard deviation of the
|
928
|
+
Laplacian, in pixels.</span> The default is 1.0.</dd>
|
929
|
+
|
930
|
+
<dt>channel...</dt>
|
931
|
+
|
932
|
+
<dd>0 or more <a href=
|
933
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
934
|
+
channels are specified, blurs all the channels. Specifying no
|
935
|
+
channel arguments has the same effect as the
|
936
|
+
<code>adaptive_blur</code> method, above.</dd>
|
937
|
+
</dl>
|
938
|
+
|
939
|
+
<h4>Returns</h4>
|
940
|
+
|
941
|
+
<p>A new image</p>
|
942
|
+
|
943
|
+
<h4>See also</h4>
|
944
|
+
|
945
|
+
<p><a href="#adaptive_blur">adaptive_blur</a></p>
|
946
|
+
|
947
|
+
<h4>Magick API</h4>
|
948
|
+
|
949
|
+
<p>AdaptiveBlurImageChannel</p>
|
950
|
+
</div>
|
951
|
+
|
952
|
+
<div class="sig">
|
953
|
+
<h3 id="adaptive_resize">adaptive_resize</h3>
|
954
|
+
|
955
|
+
<p><span class="arg">img</span>.adaptive_resize(<span class=
|
956
|
+
"arg">new_width</span>, <span class="arg">new_height</span>)
|
957
|
+
-> <em>image</em><br />
|
958
|
+
<span class="arg">img</span>.adaptive_resize(<span class=
|
959
|
+
"arg">scale_factor</span>) -> <span class=
|
960
|
+
"arg">image</span></p>
|
961
|
+
</div>
|
962
|
+
|
963
|
+
<div class="desc">
|
964
|
+
<h4>Description</h4>
|
965
|
+
|
966
|
+
<p>Resizes the image with data dependent triangulation.</p>
|
967
|
+
|
968
|
+
<h4>Arguments</h4>
|
969
|
+
|
970
|
+
<p>You can specify the new size in two ways. Either specify the
|
971
|
+
new width and height explicitly, or specify a <em>scale
|
972
|
+
factor</em>, a number that represents the percentage
|
973
|
+
change.</p>
|
974
|
+
|
975
|
+
<p>Use the <a href="#change_geometry">change_geometry</a>
|
976
|
+
method to compute new dimensions for an image with constraints
|
977
|
+
such as "maintain the current proportions."</p>
|
978
|
+
|
979
|
+
<dl>
|
980
|
+
<dt>new_width, new_height</dt>
|
981
|
+
|
982
|
+
<dd>The desired width and height.</dd>
|
983
|
+
|
984
|
+
<dt>scale_factor</dt>
|
985
|
+
|
986
|
+
<dd>You can use this argument instead of specifying the
|
987
|
+
desired width and height. The percentage size change. For
|
988
|
+
example, 1.25 makes the new image 125% of the size of the
|
989
|
+
receiver. The scale factor 0.5 makes the new image 50% of the
|
990
|
+
size of the receiver.</dd>
|
991
|
+
</dl>
|
992
|
+
|
993
|
+
<h4>Returns</h4>
|
994
|
+
|
995
|
+
<p>A new image</p>
|
996
|
+
|
997
|
+
<h4>See also</h4>
|
998
|
+
|
999
|
+
<p><a href="image3.html#resize">resize</a></p>
|
1000
|
+
|
1001
|
+
<h4>Magick API</h4>
|
1002
|
+
|
1003
|
+
<p>AdaptiveResizeImage</p>
|
1004
|
+
</div>
|
1005
|
+
|
1006
|
+
<div class="sig">
|
1007
|
+
<h3 id="adaptive_sharpen">adaptive_sharpen</h3>
|
1008
|
+
|
1009
|
+
<p><span class="arg">img</span>.adaptive_sharpen(<span class=
|
1010
|
+
"arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0)
|
1011
|
+
-> <em>image</em></p>
|
1012
|
+
</div>
|
1013
|
+
|
1014
|
+
<div class="desc">
|
1015
|
+
<h4>Description</h4>
|
1016
|
+
|
1017
|
+
<p><span class="imquote">Adaptively sharpens the image by
|
1018
|
+
sharpening more intensely near image edges and less intensely
|
1019
|
+
far from edges.</span> The adaptive_sharpen method sharpens
|
1020
|
+
<span class="imquote">the image with a Gaussian operator of the
|
1021
|
+
given</span> <span class="arg">radius</span> <span class=
|
1022
|
+
"imquote">and standard deviation</span> (<span class=
|
1023
|
+
"arg">sigma</span>). <span class="imquote">For reasonable
|
1024
|
+
results,</span> <span class="arg">radius</span> <span class=
|
1025
|
+
"imquote">should be larger than</span> <span class=
|
1026
|
+
"arg">sigma</span>. <span class="imquote">Use a</span>
|
1027
|
+
<span class="arg">radius</span> <span class="imquote">of 0 and
|
1028
|
+
adaptive_sharpen selects a suitable</span> <span class=
|
1029
|
+
"arg">radius</span> <span class="imquote">for you.</span></p>
|
1030
|
+
|
1031
|
+
<h4>Arguments</h4>
|
1032
|
+
|
1033
|
+
<dl>
|
1034
|
+
<dt>radius</dt>
|
1035
|
+
|
1036
|
+
<dd><span class="imquote">The radius of the Gaussian in
|
1037
|
+
pixels, not counting the center pixel.</span> The default is
|
1038
|
+
0.0.</dd>
|
1039
|
+
|
1040
|
+
<dt>sigma</dt>
|
1041
|
+
|
1042
|
+
<dd><span class="imquote">The standard deviation of the
|
1043
|
+
Laplacian, in pixels.</span> The default is 1.0.</dd>
|
1044
|
+
</dl>
|
1045
|
+
|
1046
|
+
<h4>Returns</h4>
|
1047
|
+
|
1048
|
+
<p>A new image</p>
|
1049
|
+
|
1050
|
+
<h4>See also</h4>
|
1051
|
+
|
1052
|
+
<p><a href=
|
1053
|
+
"#adaptive_sharpen_channel">adaptive_sharpen_channel</a></p>
|
1054
|
+
|
1055
|
+
<h4>Magick API</h4>
|
1056
|
+
|
1057
|
+
<p>AdaptiveSharpenImage</p>
|
1058
|
+
</div>
|
1059
|
+
|
1060
|
+
<div class="sig">
|
1061
|
+
<h3 id="adaptive_sharpen_channel">adaptive_sharpen_channel</h3>
|
1062
|
+
|
1063
|
+
<p><span class="arg">img</span>.adaptive_sharpen(<span class=
|
1064
|
+
"arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0
|
1065
|
+
[,<span class="arg">channel</span>...]) ->
|
1066
|
+
<em>image</em></p>
|
1067
|
+
</div>
|
1068
|
+
|
1069
|
+
<div class="desc">
|
1070
|
+
<h4>Description</h4>
|
1071
|
+
|
1072
|
+
<p>The same as <code>adaptive_sharpen</code> except only the
|
1073
|
+
specified channels are sharpened.</p>
|
1074
|
+
|
1075
|
+
<h4>Arguments</h4>
|
1076
|
+
|
1077
|
+
<dl>
|
1078
|
+
<dt>radius</dt>
|
1079
|
+
|
1080
|
+
<dd><span class="imquote">The radius of the Gaussian in
|
1081
|
+
pixels, not counting the center pixel.</span> The default is
|
1082
|
+
0.0.</dd>
|
1083
|
+
|
1084
|
+
<dt>sigma</dt>
|
1085
|
+
|
1086
|
+
<dd><span class="imquote">The standard deviation of the
|
1087
|
+
Laplacian, in pixels.</span> The default is 1.0.</dd>
|
1088
|
+
|
1089
|
+
<dt>channel...</dt>
|
1090
|
+
|
1091
|
+
<dd>0 or more <a href=
|
1092
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
1093
|
+
channels are specified, sharpens all the channels. Specifying
|
1094
|
+
no channel arguments has the same effect as the
|
1095
|
+
<code>adaptive_sharpen</code> method, above.</dd>
|
1096
|
+
</dl>
|
1097
|
+
|
1098
|
+
<h4>Returns</h4>
|
1099
|
+
|
1100
|
+
<p>A new image</p>
|
1101
|
+
|
1102
|
+
<h4>See also</h4>
|
1103
|
+
|
1104
|
+
<p><a href="#adaptive_sharpen">adaptive_sharpen</a></p>
|
1105
|
+
|
1106
|
+
<h4>Magick API</h4>
|
1107
|
+
|
1108
|
+
<p>AdaptiveSharpenImageChannel</p>
|
1109
|
+
</div>
|
1110
|
+
|
1111
|
+
<div class="sig">
|
1112
|
+
<h3 id="adaptive_threshold">adaptive_threshold</h3>
|
1113
|
+
|
1114
|
+
<p><span class="arg">img</span>.adaptive_threshold(<span class=
|
1115
|
+
"arg">width</span>=3, <span class="arg">height</span>=3,
|
1116
|
+
<span class="arg">offset</span>=0) -> <em>image</em></p>
|
1117
|
+
</div>
|
1118
|
+
|
1119
|
+
<div class="desc">
|
1120
|
+
<h4>Description</h4>
|
1121
|
+
|
1122
|
+
<p class="imquote">Selects an individual threshold for each
|
1123
|
+
pixel based on the range of intensity values in its local
|
1124
|
+
neighborhood. This allows for thresholding of an image whose
|
1125
|
+
global intensity histogram doesn't contain distinctive
|
1126
|
+
peaks.</p>
|
1127
|
+
|
1128
|
+
<h4>Arguments</h4>
|
1129
|
+
|
1130
|
+
<dl>
|
1131
|
+
<dt>width, height</dt>
|
1132
|
+
|
1133
|
+
<dd>define the width and height of the local
|
1134
|
+
neighborhood</dd>
|
1135
|
+
|
1136
|
+
<dt>offset</dt>
|
1137
|
+
|
1138
|
+
<dd>constant to subtract from pixel neighborhood mean</dd>
|
1139
|
+
</dl>
|
1140
|
+
|
1141
|
+
<h4>Returns</h4>
|
1142
|
+
|
1143
|
+
<p>A new image</p>
|
1144
|
+
|
1145
|
+
<h4>Example</h4>
|
1146
|
+
|
1147
|
+
<p class="rollover"><a href=
|
1148
|
+
"javascript:popup('adaptive_threshold.rb.html')"><img src=
|
1149
|
+
"ex/adaptive_threshold.jpg" onmouseover=
|
1150
|
+
"this.src='ex/images/Flower_Hat.jpg'" onmouseout=
|
1151
|
+
"this.src='ex/adaptive_threshold.jpg'" alt=
|
1152
|
+
"adaptive_threshold example" title=
|
1153
|
+
"Click to see the example script" /></a> <img src=
|
1154
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
1155
|
+
"Mouse over the example to see the original image" /></p>
|
1156
|
+
|
1157
|
+
<h4>See also</h4>
|
1158
|
+
|
1159
|
+
<p><a href="#bilevel_channel">bilevel_channel</a>, <a href=
|
1160
|
+
"image3.html#random_threshold_channel">random_threshold_channel</a>,
|
1161
|
+
<a href="image3.html#threshold">threshold</a></p>
|
1162
|
+
|
1163
|
+
<h4>Magick API</h4>
|
1164
|
+
|
1165
|
+
<p>AdaptiveThresholdImage</p>
|
1166
|
+
</div>
|
1167
|
+
|
1168
|
+
<div class="sig">
|
1169
|
+
<h3 id="add_compose_mask">add_compose_mask</h3>
|
1170
|
+
|
1171
|
+
<p><span class="arg">img</span>.add_compose_mask(<span class=
|
1172
|
+
"arg">mask</span>) -> <em>self</em></p>
|
1173
|
+
</div>
|
1174
|
+
|
1175
|
+
<div class="desc">
|
1176
|
+
<h4>Description</h4>
|
1177
|
+
|
1178
|
+
<p>Associates a mask with an image that will be used as the
|
1179
|
+
destination image in a <a href="#composite">composite</a>
|
1180
|
+
operation. The areas of the destination image that are masked
|
1181
|
+
by white pixels will be modified by the <a href=
|
1182
|
+
"#composite">composite</a> method, while areas masked by black
|
1183
|
+
pixels are unchanged.</p>
|
1184
|
+
|
1185
|
+
<p>See <a href=
|
1186
|
+
"http://www.imagemagick.org/Usage/compose/#mask">Using a
|
1187
|
+
Compose Mask to Limit the Composed Area</a> in Anthony
|
1188
|
+
Thyssen's <a href="http://www.imagemagick.org/Usage/">Examples
|
1189
|
+
of ImageMagick Usage</a>.</p>
|
1190
|
+
|
1191
|
+
<h4>Arguments</h4>
|
1192
|
+
|
1193
|
+
<p>The mask image must have the same dimensions as the
|
1194
|
+
destination image.</p>
|
1195
|
+
|
1196
|
+
<h4>Returns</h4>
|
1197
|
+
|
1198
|
+
<p>self</p>
|
1199
|
+
|
1200
|
+
<h4>Example</h4>
|
1201
|
+
|
1202
|
+
<div>
|
1203
|
+
<table summary="compose_mask example">
|
1204
|
+
<tr>
|
1205
|
+
<td><a href=
|
1206
|
+
"javascript:add_popup('compose_mask.rb.html')"><img src=
|
1207
|
+
"ex/images/Flower_Hat.jpg" width="100" height="125" alt=
|
1208
|
+
"Source image for add_compose_mask example" title=
|
1209
|
+
"Click to see the example script" /></a></td>
|
1210
|
+
|
1211
|
+
<td><a href=
|
1212
|
+
"javascript:add_popup('compose_mask.rb.html')"><img src=
|
1213
|
+
"ex/compose_mask_source.gif" width="100" height="125"
|
1214
|
+
alt="Background image for add_compose_mask example"
|
1215
|
+
title="Click to see the example script" /></a></td>
|
1216
|
+
|
1217
|
+
<td><a href=
|
1218
|
+
"javascript:add_popup('compose_mask.rb.html')"><img src=
|
1219
|
+
"ex/compose_mask.gif" width="100" height="125" alt=
|
1220
|
+
"Mask image for compose_mask example" title=
|
1221
|
+
"Click to see the example script" /></a></td>
|
1222
|
+
|
1223
|
+
<td><a href=
|
1224
|
+
"javascript:add_popup('compose_mask.rb.html')"><img src=
|
1225
|
+
"ex/compose_mask_example.jpg" width="93" height="125"
|
1226
|
+
alt="Result image for compose_mask example" title=
|
1227
|
+
"Click to see the example script" /></a></td>
|
1228
|
+
</tr>
|
1229
|
+
|
1230
|
+
<tr>
|
1231
|
+
<td align="center">Background</td>
|
1232
|
+
|
1233
|
+
<td align="center">Source</td>
|
1234
|
+
|
1235
|
+
<td align="center">Mask</td>
|
1236
|
+
|
1237
|
+
<td align="center">Result</td>
|
1238
|
+
</tr>
|
1239
|
+
</table>
|
1240
|
+
</div>
|
1241
|
+
|
1242
|
+
<h4>See also</h4>
|
1243
|
+
|
1244
|
+
<p><a href="#composite">composite</a>, <a href=
|
1245
|
+
"#delete_compose_mask">delete_compose_mask</a></p>
|
1246
|
+
|
1247
|
+
<h4>Notes</h4>
|
1248
|
+
|
1249
|
+
<p>This method uses a <em>copy</em> of the argument as the
|
1250
|
+
mask. If you change the mask image you must call this method
|
1251
|
+
again to update the mask.</p>
|
1252
|
+
|
1253
|
+
<h4>Magick API</h4>
|
1254
|
+
|
1255
|
+
<p>SetImageMask</p>
|
1256
|
+
</div>
|
1257
|
+
|
1258
|
+
<div class="sig">
|
1259
|
+
<h3 id="add_noise">add_noise</h3>
|
1260
|
+
|
1261
|
+
<p><span class="arg">img</span>.add_noise(<span class=
|
1262
|
+
"arg">noise_type</span>) -> <em>image</em></p>
|
1263
|
+
</div>
|
1264
|
+
|
1265
|
+
<div class="desc">
|
1266
|
+
<h4>Description</h4>
|
1267
|
+
|
1268
|
+
<p>Adds random noise to the image. The amount of time
|
1269
|
+
<code>add_noise</code> requires depends on the NoiseType
|
1270
|
+
argument.</p>
|
1271
|
+
|
1272
|
+
<h4>Arguments</h4>
|
1273
|
+
|
1274
|
+
<p>A <a href="constants.html#NoiseType">NoiseType</a>
|
1275
|
+
value.</p>
|
1276
|
+
|
1277
|
+
<h4>Returns</h4>
|
1278
|
+
|
1279
|
+
<p>A new image</p>
|
1280
|
+
|
1281
|
+
<h4>Example</h4>
|
1282
|
+
|
1283
|
+
<div class="noise_example_wrapper">
|
1284
|
+
<a href="javascript:popup('add_noise.rb.html')"><img src=
|
1285
|
+
"ex/images/Flower_Hat.jpg" alt="add_noise example" id=
|
1286
|
+
"add_noise_example" title=
|
1287
|
+
"Click to see the example script" /></a>
|
1288
|
+
|
1289
|
+
<p>Click the NoiseType to see the effect.</p>
|
1290
|
+
|
1291
|
+
<ul>
|
1292
|
+
<li><a href="javascript:show_noise(null)">No noise</a></li>
|
1293
|
+
|
1294
|
+
<li><a href=
|
1295
|
+
"javascript:show_noise('UniformNoise');">UniformNoise</a></li>
|
1296
|
+
|
1297
|
+
<li><a href=
|
1298
|
+
"javascript:show_noise('GaussianNoise');">GaussianNoise</a></li>
|
1299
|
+
|
1300
|
+
<li><a href=
|
1301
|
+
"javascript:show_noise('MultiplicativeGaussianNoise');">MultiplicativeGaussianNoise</a></li>
|
1302
|
+
|
1303
|
+
<li><a href=
|
1304
|
+
"javascript:show_noise('ImpulseNoise');">ImpulseNoise</a></li>
|
1305
|
+
|
1306
|
+
<li><a href=
|
1307
|
+
"javascript:show_noise('LaplacianNoise');">LaplacianNoise</a></li>
|
1308
|
+
|
1309
|
+
<li><a href=
|
1310
|
+
"javascript:show_noise('PoissonNoise');">PoissonNoise</a></li>
|
1311
|
+
</ul>
|
1312
|
+
</div>
|
1313
|
+
|
1314
|
+
<div style="clear: both;"></div>
|
1315
|
+
|
1316
|
+
<h4>Notes</h4>
|
1317
|
+
|
1318
|
+
<p>The RandomNoise type was added in ImageMagick 6.3.5.</p>
|
1319
|
+
|
1320
|
+
<h4>Magick API</h4>
|
1321
|
+
|
1322
|
+
<p>AddNoiseImage</p>
|
1323
|
+
|
1324
|
+
<h4>See also</h4>
|
1325
|
+
|
1326
|
+
<p><a href="#add_noise_channel">add_noise_channel</a></p>
|
1327
|
+
</div>
|
1328
|
+
|
1329
|
+
<div class="sig">
|
1330
|
+
<h3 id="add_profile">add_profile</h3>
|
1331
|
+
|
1332
|
+
<p><span class="arg">img</span>.add_profile(<span class=
|
1333
|
+
"arg">filename</span>) -> <span class="arg">self</span></p>
|
1334
|
+
</div>
|
1335
|
+
|
1336
|
+
<div class="desc">
|
1337
|
+
<h4>Description</h4>
|
1338
|
+
|
1339
|
+
<p>Adds an ICC (a.k.a. ICM), IPTC, or generic profile. If the
|
1340
|
+
file contains more than one profile all the profiles are
|
1341
|
+
added.</p>
|
1342
|
+
|
1343
|
+
<h4>Arguments</h4>
|
1344
|
+
|
1345
|
+
<p>The filename of a file containing the profile.</p>
|
1346
|
+
|
1347
|
+
<h4>Returns</h4>
|
1348
|
+
|
1349
|
+
<p>self</p>
|
1350
|
+
|
1351
|
+
<h4>Example</h4>
|
1352
|
+
<pre>
|
1353
|
+
img.add_profile('my_cmyk.icm')
|
1354
|
+
</pre>
|
1355
|
+
|
1356
|
+
<h4>See also</h4>
|
1357
|
+
|
1358
|
+
<p>The <a href="imageattrs.html#iptc_profile">iptc_profile</a>
|
1359
|
+
and <a href="imageattrs.html#color_profile">color_profile</a>
|
1360
|
+
attributes provide very similar functionality, except that
|
1361
|
+
these attributes accept the profile data in the form of a
|
1362
|
+
string. The <a href="image3.html#profile_bang">profile!</a>
|
1363
|
+
method can also be used to add a profile. The type of profile
|
1364
|
+
must be specified and the profile data must be in the form of a
|
1365
|
+
string. Also see <a href="#delete_profile">delete_profile</a>
|
1366
|
+
and <a href="image2.html#each_profile">each_profile</a>.</p>
|
1367
|
+
|
1368
|
+
<h4>Magick API</h4>
|
1369
|
+
|
1370
|
+
<p>ProfileImage</p>
|
1371
|
+
</div>
|
1372
|
+
|
1373
|
+
<div class="sig">
|
1374
|
+
<h3 id="add_noise_channel">add_noise_channel</h3>
|
1375
|
+
|
1376
|
+
<p><span class="arg">img</span>.add_noise_channel(<span class=
|
1377
|
+
"arg">noise_type</span> [,<span class="arg">channel</span>...])
|
1378
|
+
-> <em>image</em></p>
|
1379
|
+
</div>
|
1380
|
+
|
1381
|
+
<div class="desc">
|
1382
|
+
<h4>Description</h4>
|
1383
|
+
|
1384
|
+
<p>Adds random noise to the specified channel or channels in
|
1385
|
+
the image.</p>
|
1386
|
+
|
1387
|
+
<h4>Arguments</h4>
|
1388
|
+
|
1389
|
+
<dl>
|
1390
|
+
<dt>noise_type</dt>
|
1391
|
+
|
1392
|
+
<dd>A <a href="constants.html#NoiseType">NoiseType</a>
|
1393
|
+
value.</dd>
|
1394
|
+
|
1395
|
+
<dt>channel...</dt>
|
1396
|
+
|
1397
|
+
<dd>0 or more <a href=
|
1398
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
1399
|
+
channels are specified, adds noise to all the channels.
|
1400
|
+
Specifying no channel arguments has the same effect as the
|
1401
|
+
<code>add_noise</code> method, above.</dd>
|
1402
|
+
</dl>
|
1403
|
+
|
1404
|
+
<h4>Returns</h4>
|
1405
|
+
|
1406
|
+
<p>A new image</p>
|
1407
|
+
|
1408
|
+
<h4>Magick API</h4>
|
1409
|
+
|
1410
|
+
<p>AddNoiseImageChannel</p>
|
1411
|
+
|
1412
|
+
<h4>See also</h4>
|
1413
|
+
|
1414
|
+
<p><a href="#add_noise">add_noise</a></p>
|
1415
|
+
</div>
|
1416
|
+
|
1417
|
+
<div class="sig">
|
1418
|
+
<h3 id="affine_transform">affine_transform</h3>
|
1419
|
+
|
1420
|
+
<p><span class="arg">img</span>.affine_transform(<span class=
|
1421
|
+
"arg">matrix</span>) -> <em>image</em></p>
|
1422
|
+
</div>
|
1423
|
+
|
1424
|
+
<div class="desc">
|
1425
|
+
<h4>Description</h4>
|
1426
|
+
|
1427
|
+
<p>Transforms the image as specified by the affine matrix.</p>
|
1428
|
+
|
1429
|
+
<p>See <a href=
|
1430
|
+
"http://www.w3.org/TR/SVG/coords.html#EstablishingANewUserSpace">
|
1431
|
+
<b>Coordinate system transformations</b></a> in the
|
1432
|
+
<cite>Scalable Vector Graphics (SVG) 1.0 Specification</cite>
|
1433
|
+
for more information about transformation matrices.</p>
|
1434
|
+
|
1435
|
+
<h4>Arguments</h4>
|
1436
|
+
|
1437
|
+
<p>An <a href=
|
1438
|
+
"struct.html#AffineMatrix"><code>AffineMatrix</code></a>
|
1439
|
+
object.</p>
|
1440
|
+
|
1441
|
+
<h4>Returns</h4>
|
1442
|
+
|
1443
|
+
<p>A new image</p>
|
1444
|
+
|
1445
|
+
<h4>Example</h4>
|
1446
|
+
|
1447
|
+
<p>The affine matrix in this example skews the receiver by
|
1448
|
+
π/6 radians along both axes.</p>
|
1449
|
+
|
1450
|
+
<p class="rollover"><a href=
|
1451
|
+
"javascript:popup('affine_transform.rb.html')"><img onmouseover="this.src='ex/images/Flower_Hat.jpg'"
|
1452
|
+
onmouseout="this.src='ex/affine_transform.jpg'" src=
|
1453
|
+
"ex/affine_transform.jpg" alt="affine_transform example" title=
|
1454
|
+
"Click to see the example script" /></a> <img src=
|
1455
|
+
"ex/images/spin.gif" alt="" class="spin" style="left: 235px;"
|
1456
|
+
title="Mouse over the example to see the original image" /></p>
|
1457
|
+
|
1458
|
+
<h4>See also</h4>
|
1459
|
+
|
1460
|
+
<p><a href="image3.html#rotate">rotate</a>, <a href=
|
1461
|
+
"#shear">shear</a></p>
|
1462
|
+
|
1463
|
+
<h4>Magick API</h4>
|
1464
|
+
|
1465
|
+
<p>AffineTransformImage</p>
|
1466
|
+
</div>
|
1467
|
+
|
1468
|
+
<div class="sig">
|
1469
|
+
<h3 id="alpha">alpha</h3>
|
1470
|
+
|
1471
|
+
<p><span class="arg">img</span>.alpha(<span class=
|
1472
|
+
"arg">type</span>) -> <em>type</em></p>
|
1473
|
+
</div>
|
1474
|
+
|
1475
|
+
<div class="desc">
|
1476
|
+
<h4>Description</h4>
|
1477
|
+
|
1478
|
+
<p>Set a flag to indicate whether or not to use alpha channel
|
1479
|
+
data.</p>
|
1480
|
+
|
1481
|
+
<h4>Arguments</h4>
|
1482
|
+
|
1483
|
+
<p>One of the following values of the AlphaChannelType
|
1484
|
+
enumeration:</p>
|
1485
|
+
|
1486
|
+
<dl>
|
1487
|
+
<dt>ActivateAlphaChannel</dt>
|
1488
|
+
|
1489
|
+
<dd class="imquote">Enable the images use of transparency. If
|
1490
|
+
transparency data did not exist, allocate the data and set to
|
1491
|
+
opaque. If the image previously had transparency data, the
|
1492
|
+
data is again enable as it was when turned off. The
|
1493
|
+
transparency data is not changed or modified in any way.</dd>
|
1494
|
+
|
1495
|
+
<dt>BackgroundAlphaChannel</dt>
|
1496
|
+
|
1497
|
+
<dd>Set fully transparent pixels to the background color.
|
1498
|
+
(Available in IM 6.5.2-5.)</dd>
|
1499
|
+
|
1500
|
+
<dt>CopyAlphaChannel</dt>
|
1501
|
+
|
1502
|
+
<dd class="imquote">Turns on the alpha/matte channel, then
|
1503
|
+
copies the gray-scale intensity of the image, as an alpha
|
1504
|
+
mask, into the alpha channel, converting a gray-scale mask
|
1505
|
+
into a transparent shaped image ready to be colored
|
1506
|
+
appropriately. The color channels are not modified.</dd>
|
1507
|
+
|
1508
|
+
<dt>DeactivateAlphaChannel</dt>
|
1509
|
+
|
1510
|
+
<dd class="imquote">Disables the image's transparency
|
1511
|
+
channel. Does not delete or change the existing data, just
|
1512
|
+
turns of the use of that data. This is the same as assigning
|
1513
|
+
false to the old matte= attribute.</dd>
|
1514
|
+
|
1515
|
+
<dt>ExtractAlphaChannel</dt>
|
1516
|
+
|
1517
|
+
<dd>Creates a grayscale mask of the image's shape by copying
|
1518
|
+
the alpha channel values into all the color channels, and
|
1519
|
+
then turning off the image's transparency. The inverse of
|
1520
|
+
CopyAlphaChannel</dd>
|
1521
|
+
|
1522
|
+
<dt>OpaqueAlphaChannel</dt>
|
1523
|
+
|
1524
|
+
<dd class="imquote">Turns on the alpha/matte channel and
|
1525
|
+
forces it to be fully opaque.</dd>
|
1526
|
+
|
1527
|
+
<dt>ResetAlphaChannel</dt>
|
1528
|
+
|
1529
|
+
<dd>(Deprecated as of IM 6.4.3-7.) Set the alpha channel to
|
1530
|
+
fully opaque.</dd>
|
1531
|
+
|
1532
|
+
<dt>SetAlphaChannel</dt>
|
1533
|
+
|
1534
|
+
<dd class="imquote">Turns on the alpha/matte channel and if
|
1535
|
+
it was previously turned off resets the channel to opaque. If
|
1536
|
+
the image already had the alpha channel turned on, it will
|
1537
|
+
have no effect.</dd>
|
1538
|
+
|
1539
|
+
<dt>ShapeAlphaChannel</dt>
|
1540
|
+
|
1541
|
+
<dd class="imquote">As CopyAlphaChannel but also colors the
|
1542
|
+
resulting shape mask with the current background color.</dd>
|
1543
|
+
|
1544
|
+
<dt>TransparentAlphaChannel</dt>
|
1545
|
+
|
1546
|
+
<dd class="imquote">Turns on the alpha/matte channel and
|
1547
|
+
forces it to be fully transparent. This effectivally creates
|
1548
|
+
a transparent image the same size as the original, with all
|
1549
|
+
its meta-data still attached.</dd>
|
1550
|
+
</dl>
|
1551
|
+
|
1552
|
+
<h4>Returns</h4>
|
1553
|
+
|
1554
|
+
<p>The argument.</p>
|
1555
|
+
|
1556
|
+
<h4>See also</h4>
|
1557
|
+
|
1558
|
+
<p><a href="#alpha_q">alpha?</a></p>
|
1559
|
+
|
1560
|
+
<h4>Notes</h4>
|
1561
|
+
|
1562
|
+
<p>Available in ImageMagick 6.3.5 and later.</p>
|
1563
|
+
|
1564
|
+
<h4>Magick API</h4>
|
1565
|
+
|
1566
|
+
<p>SetImageAlphaChannel</p>
|
1567
|
+
</div>
|
1568
|
+
|
1569
|
+
<div class="sig">
|
1570
|
+
<h3 id="alpha_q">alpha?</h3>
|
1571
|
+
|
1572
|
+
<p><span class="arg">img</span>.alpha? -> <code>true</code>
|
1573
|
+
or <code>false</code></p>
|
1574
|
+
</div>
|
1575
|
+
|
1576
|
+
<div class="desc">
|
1577
|
+
<h4>Description</h4>
|
1578
|
+
|
1579
|
+
<p>Returns <code>true</code> if the alpha channel will be used,
|
1580
|
+
<code>false</code> otherwise.</p>
|
1581
|
+
|
1582
|
+
<h4>See also</h4>
|
1583
|
+
|
1584
|
+
<p><a href="#alpha">alpha</a></p>
|
1585
|
+
|
1586
|
+
<h4>Magick API</h4>
|
1587
|
+
|
1588
|
+
<p>GetImageAlphaChannel</p>
|
1589
|
+
</div>
|
1590
|
+
|
1591
|
+
<div class="sig">
|
1592
|
+
<h3 id="annotate">annotate</h3>
|
1593
|
+
|
1594
|
+
<p><span class="arg">img.</span>annotate(<span class=
|
1595
|
+
"arg">draw, width, height, x, y, text</span>) <span class=
|
1596
|
+
"arg">[ { additional parameters } ]</span> ->
|
1597
|
+
<em>self</em></p>
|
1598
|
+
</div>
|
1599
|
+
|
1600
|
+
<div class="desc">
|
1601
|
+
<h4>Description</h4>
|
1602
|
+
|
1603
|
+
<p>This is the same method as the <code>annotate</code> method
|
1604
|
+
in the Draw class, except that the first argument is a Draw
|
1605
|
+
object. Refer to the documentation for <a href=
|
1606
|
+
"draw.html#annotate">Draw#annotate</a> for more information.
|
1607
|
+
Some users feel like <code>annotate</code> is better placed in
|
1608
|
+
Image than in Draw. Okay, here it is!</p>
|
1609
|
+
|
1610
|
+
<h4>Returns</h4>
|
1611
|
+
|
1612
|
+
<p>self</p>
|
1613
|
+
</div>
|
1614
|
+
|
1615
|
+
<div class="sig">
|
1616
|
+
<h3 id="auto_gamma_channel">auto_gamma_channel</h3>
|
1617
|
+
|
1618
|
+
<p><span class=
|
1619
|
+
"arg">img</span>.auto_gamma_channel([<span class="arg">channel</span>...])
|
1620
|
+
-> <em>image</em></p>
|
1621
|
+
</div>
|
1622
|
+
|
1623
|
+
<div class="desc">
|
1624
|
+
<h4>Description</h4>
|
1625
|
+
|
1626
|
+
<p>"Automagically" adjust the gamma level of an image.</p>
|
1627
|
+
|
1628
|
+
<h4>Arguments</h4>
|
1629
|
+
|
1630
|
+
<dl>
|
1631
|
+
<dt>channel...</dt>
|
1632
|
+
|
1633
|
+
<dd>0 or more <a href=
|
1634
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
1635
|
+
channels are specified, automagically adjusts the gamma level
|
1636
|
+
of all the channels.</dd>
|
1637
|
+
</dl>
|
1638
|
+
|
1639
|
+
<h4>Returns</h4>
|
1640
|
+
|
1641
|
+
<p>A new image</p>
|
1642
|
+
</div>
|
1643
|
+
|
1644
|
+
<div class="sig">
|
1645
|
+
<h3 id="auto_level_channel">auto_level_channel</h3>
|
1646
|
+
|
1647
|
+
<p><span class=
|
1648
|
+
"arg">img</span>.auto_level_channel([<span class="arg">channel</span>...])
|
1649
|
+
-> <em>image</em></p>
|
1650
|
+
</div>
|
1651
|
+
|
1652
|
+
<div class="desc">
|
1653
|
+
<h4>Description</h4>
|
1654
|
+
|
1655
|
+
<p>"Automagically" adjust the color levels of an image.</p>
|
1656
|
+
|
1657
|
+
<h4>Arguments</h4>
|
1658
|
+
|
1659
|
+
<dl>
|
1660
|
+
<dt>channel...</dt>
|
1661
|
+
|
1662
|
+
<dd>0 or more <a href=
|
1663
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
1664
|
+
channels are specified, automagically adjusts the color level
|
1665
|
+
of all the channels.</dd>
|
1666
|
+
</dl>
|
1667
|
+
|
1668
|
+
<h4>Returns</h4>
|
1669
|
+
|
1670
|
+
<p>A new image</p>
|
1671
|
+
</div>
|
1672
|
+
|
1673
|
+
<div class="sig">
|
1674
|
+
<h3 id="auto_orient">auto_orient</h3>
|
1675
|
+
|
1676
|
+
<p><span class="arg">img</span>.auto_orient ->
|
1677
|
+
<em>image</em></p>
|
1678
|
+
</div>
|
1679
|
+
|
1680
|
+
<div class="desc">
|
1681
|
+
<h4>Description</h4>
|
1682
|
+
|
1683
|
+
<p>Rotates or flips the image based on the image's EXIF
|
1684
|
+
orientation tag. Note that only some models of modern digital
|
1685
|
+
cameras can tag an image with the orientation. If the image
|
1686
|
+
does not have an orientation tag, or the image is already
|
1687
|
+
properly oriented, then <code>auto_orient</code> returns an
|
1688
|
+
exact copy of the image.</p>
|
1689
|
+
|
1690
|
+
<h4>Returns</h4>
|
1691
|
+
|
1692
|
+
<p>A new image</p>
|
1693
|
+
|
1694
|
+
<h4>See also</h4>
|
1695
|
+
|
1696
|
+
<p><a href="#auto_orient_bang">auto_orient!</a></p>
|
1697
|
+
|
1698
|
+
<h4>Magick API</h4>
|
1699
|
+
|
1700
|
+
<p>FlipImage, FlopImage, RotateImage, TransposeImage,
|
1701
|
+
TransverseImage</p>
|
1702
|
+
</div>
|
1703
|
+
|
1704
|
+
<div class="sig">
|
1705
|
+
<h3 id="auto_orient_bang">auto_orient!</h3>
|
1706
|
+
|
1707
|
+
<p><span class="arg">img</span>.auto_orient! ->
|
1708
|
+
<em>self</em></p>
|
1709
|
+
</div>
|
1710
|
+
|
1711
|
+
<div class="desc">
|
1712
|
+
<h4>Description</h4>
|
1713
|
+
|
1714
|
+
<p>Rotates or flips the image based on the image's EXIF
|
1715
|
+
orientation tag. Note that only some models of modern digital
|
1716
|
+
cameras can tag an image with the orientation. If the image
|
1717
|
+
does not have an orientation tag, or the image is already
|
1718
|
+
properly oriented, then <code>auto_orient!</code> returns
|
1719
|
+
<code>nil</code>.</p>
|
1720
|
+
|
1721
|
+
<h4>Returns</h4>
|
1722
|
+
|
1723
|
+
<p>self. or <code>nil</code> if the image is already properly
|
1724
|
+
oriented</p>
|
1725
|
+
|
1726
|
+
<h4>See also</h4>
|
1727
|
+
|
1728
|
+
<p><a href="#auto_orient">auto_orient</a></p>
|
1729
|
+
</div>
|
1730
|
+
|
1731
|
+
<div class="sig">
|
1732
|
+
<h3 id="bilevel_channel">bilevel_channel</h3>
|
1733
|
+
|
1734
|
+
<p><span class="arg">img</span>.bilevel_channel(<span class=
|
1735
|
+
"arg">threshold</span> [,<span class="arg">channel...</span>])
|
1736
|
+
-> <em>image</em></p>
|
1737
|
+
</div>
|
1738
|
+
|
1739
|
+
<div class="desc">
|
1740
|
+
<h4>Description</h4>
|
1741
|
+
|
1742
|
+
<p class="imquote">Changes the value of individual pixels based
|
1743
|
+
on the intensity of each pixel channel. The result is a
|
1744
|
+
high-contrast image.</p>
|
1745
|
+
|
1746
|
+
<h4>Arguments</h4>
|
1747
|
+
|
1748
|
+
<dl>
|
1749
|
+
<dt>threshold</dt>
|
1750
|
+
|
1751
|
+
<dd>The threshold value, a number between 0 and
|
1752
|
+
QuantumRange.</dd>
|
1753
|
+
|
1754
|
+
<dt>channel...</dt>
|
1755
|
+
|
1756
|
+
<dd>0 or more <a href=
|
1757
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
1758
|
+
channels are specified, all the channels are
|
1759
|
+
thresholded.</dd>
|
1760
|
+
</dl>
|
1761
|
+
|
1762
|
+
<h4>Returns</h4>
|
1763
|
+
|
1764
|
+
<p>A new image</p>
|
1765
|
+
|
1766
|
+
<h4>Example</h4>
|
1767
|
+
|
1768
|
+
<p><code>bilevel_channel(2*QuantumRange/3,
|
1769
|
+
RedChannel)</code></p>
|
1770
|
+
|
1771
|
+
<p class="rollover"><a href=
|
1772
|
+
"javascript:popup('bilevel_channel.rb.html')"><img onmouseover=
|
1773
|
+
"this.src='ex/images/Flower_Hat.jpg'" onmouseout=
|
1774
|
+
"this.src='ex/bilevel_channel.jpg'" src=
|
1775
|
+
"ex/bilevel_channel.jpg" alt="bilevel_channel example" title=
|
1776
|
+
"Click to see the example script" /></a> <img src=
|
1777
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
1778
|
+
"Mouse over the example to see the original image" /></p>
|
1779
|
+
|
1780
|
+
<h4>See also</h4>
|
1781
|
+
|
1782
|
+
<p><a href="#adaptive_threshold">adaptive_threshold</a>,
|
1783
|
+
<a href=
|
1784
|
+
"image3.html#random_threshold_channel">random_threshold_channel</a></p>
|
1785
|
+
|
1786
|
+
<h4>Magick API</h4>
|
1787
|
+
|
1788
|
+
<p>BilevelImageChannel</p>
|
1789
|
+
</div>
|
1790
|
+
|
1791
|
+
<div class="sig">
|
1792
|
+
<h3 id="black_threshold">black_threshold</h3>
|
1793
|
+
|
1794
|
+
<p><span class="arg">img</span>.black_threshold(<span class=
|
1795
|
+
"arg">red_channel</span> [, <span class=
|
1796
|
+
"arg">green_channel</span> [, <span class=
|
1797
|
+
"arg">blue_channel</span> [, <span class=
|
1798
|
+
"arg">opacity_channel</span>]]]) -> <em>image</em></p>
|
1799
|
+
</div><!-- this example is larger than normal -->
|
1800
|
+
|
1801
|
+
<div class="desc">
|
1802
|
+
<h4>Description</h4>
|
1803
|
+
|
1804
|
+
<p class="imquote">Forces all pixels below the threshold into
|
1805
|
+
black while leaving all pixels above the threshold
|
1806
|
+
unchanged.</p>
|
1807
|
+
|
1808
|
+
<h4>Arguments</h4>
|
1809
|
+
|
1810
|
+
<p>Each channel argument is a number between 0 and
|
1811
|
+
QuantumRange. All arguments except the first may be omitted. If
|
1812
|
+
the <span class="arg">green_channel</span> or <span class=
|
1813
|
+
"arg">blue_channel</span> argument is omitted, the default
|
1814
|
+
value is the <span class="arg">red_channel</span> value. If the
|
1815
|
+
<span class="arg">opacity_channel</span> argument is omitted,
|
1816
|
+
the default value is <a href=
|
1817
|
+
"constants.html#Opacity">OpaqueOpacity</a>.</p>
|
1818
|
+
|
1819
|
+
<h4>Returns</h4>
|
1820
|
+
|
1821
|
+
<p>A new image</p>
|
1822
|
+
|
1823
|
+
<h4>See also</h4>
|
1824
|
+
|
1825
|
+
<p><a href="image3.html#white_threshold">white_threshold</a>,
|
1826
|
+
<a href="#bilevel_channel">bilevel_channel</a></p>
|
1827
|
+
|
1828
|
+
<h4>Magick API</h4>
|
1829
|
+
|
1830
|
+
<p>BlackThresholdImage</p>
|
1831
|
+
</div>
|
1832
|
+
|
1833
|
+
<div class="sig">
|
1834
|
+
<h3 id="blend">blend</h3>
|
1835
|
+
|
1836
|
+
<p><span class="arg">img</span>.blend(<span class=
|
1837
|
+
"arg">overlay</span>, <span class="arg">src_percentage</span>,
|
1838
|
+
<span class="arg">dst_percentage</span>, <span class=
|
1839
|
+
"arg">x_offset</span>=0, <span class="arg">y_offset</span>=0)
|
1840
|
+
-> <em>image</em><br />
|
1841
|
+
<span class="arg">img</span>.blend(<span class=
|
1842
|
+
"arg">overlay</span>, <span class="arg">src_percentage</span>,
|
1843
|
+
<span class="arg">dst_percentage</span>, <span class=
|
1844
|
+
"arg">gravity</span>, <span class="arg">x_offset</span>=0,
|
1845
|
+
<span class="arg">y_offset</span>=0) -> <em>image</em></p>
|
1846
|
+
</div>
|
1847
|
+
|
1848
|
+
<div class="desc">
|
1849
|
+
<h4>Description</h4>
|
1850
|
+
|
1851
|
+
<p>Adds the <span class="arg">overlay</span> image to the
|
1852
|
+
target image according to <span class="arg">src_percent</span>
|
1853
|
+
and <span class="arg">dst_percent</span>.</p>
|
1854
|
+
|
1855
|
+
<p>This method corresponds to the -blend option of
|
1856
|
+
ImageMagick's <code>composite</code> command.</p>
|
1857
|
+
|
1858
|
+
<h4>Arguments</h4>
|
1859
|
+
|
1860
|
+
<dl>
|
1861
|
+
<dt>overlay</dt>
|
1862
|
+
|
1863
|
+
<dd>The source image for the composite operation. Either an
|
1864
|
+
imagelist or an image. If an imagelist, uses the current
|
1865
|
+
image.</dd>
|
1866
|
+
|
1867
|
+
<dt>src_percentage</dt>
|
1868
|
+
|
1869
|
+
<dd>Either a non-negative number a string in the form "NN%".
|
1870
|
+
If <span class="arg">src_percentage</span> is a number it is
|
1871
|
+
interpreted as a percentage. Both 0.25 and "25%" mean 25%.
|
1872
|
+
This argument is required.</dd>
|
1873
|
+
|
1874
|
+
<dt>dst_percentage</dt>
|
1875
|
+
|
1876
|
+
<dd>Either a non-negative number a string in the form "NN%".
|
1877
|
+
If <span class="arg">src_percentage</span> is a number it is
|
1878
|
+
interpreted as a percentage. Both 0.25 and "25%" mean 25%.
|
1879
|
+
This argument may omitted if no other arguments follow it. In
|
1880
|
+
this case the default is 100%-<span class=
|
1881
|
+
"arg">src_percentage</span>.</dd>
|
1882
|
+
</dl>
|
1883
|
+
|
1884
|
+
<p>The <code>blend</code> method can be called with or without
|
1885
|
+
a <span class="arg">gravity</span> argument. The <span class=
|
1886
|
+
"arg">gravity</span>, <span class="arg">x_offset</span>, and
|
1887
|
+
<span class="arg">y_offset</span> arguments are described in
|
1888
|
+
the documentation for <a href=
|
1889
|
+
"image3.html#watermark">watermark</a>.</p>
|
1890
|
+
|
1891
|
+
<h4>Example</h4>
|
1892
|
+
|
1893
|
+
<p>See <a href=
|
1894
|
+
"http://www.cit.gu.edu.au/~anthony/graphics/imagick6/compose/#blend">
|
1895
|
+
"Blend Two Images Together"</a> in Anthony Thyssen's
|
1896
|
+
<cite><a href=
|
1897
|
+
"http://www.cit.gu.edu.au/~anthony/graphics/imagick6/">Examples
|
1898
|
+
of ImageMagick Usage</a></cite>.</p>
|
1899
|
+
|
1900
|
+
<h4>Returns</h4>
|
1901
|
+
|
1902
|
+
<p>A new image</p>
|
1903
|
+
|
1904
|
+
<h4>See also</h4>
|
1905
|
+
|
1906
|
+
<p><a href="#dissolve">dissolve</a>, <a href=
|
1907
|
+
"#composite">composite</a></p>
|
1908
|
+
</div>
|
1909
|
+
|
1910
|
+
<div class="sig">
|
1911
|
+
<h3 id="blue_shift">blue_shift</h3>
|
1912
|
+
|
1913
|
+
<p><span class="arg">img</span>.blue_shift(<span class=
|
1914
|
+
"arg">factor</span>=1.5) -> <em>image</em></p>
|
1915
|
+
</div>
|
1916
|
+
|
1917
|
+
<div class="desc">
|
1918
|
+
<h4>Description</h4>
|
1919
|
+
|
1920
|
+
<p class="imquote">Simulate a scene at nighttime in the
|
1921
|
+
moonlight.</p>
|
1922
|
+
|
1923
|
+
<h4>Arguments</h4>
|
1924
|
+
|
1925
|
+
<dl>
|
1926
|
+
<dt>factor</dt>
|
1927
|
+
|
1928
|
+
<dd>Larger values increase the effect. The default is
|
1929
|
+
1.5.</dd>
|
1930
|
+
</dl>
|
1931
|
+
|
1932
|
+
<h4>Returns</h4>
|
1933
|
+
|
1934
|
+
<p>A new image</p>
|
1935
|
+
|
1936
|
+
<h4>Notes</h4>
|
1937
|
+
|
1938
|
+
<p>Available in ImageMagick 6.5.4-3 and later.</p>
|
1939
|
+
|
1940
|
+
<h4>Magick API</h4>
|
1941
|
+
|
1942
|
+
<p>BlueShiftImage</p>
|
1943
|
+
</div>
|
1944
|
+
|
1945
|
+
<div class="sig">
|
1946
|
+
<h3 id="blur_channel">blur_channel</h3>
|
1947
|
+
|
1948
|
+
<p><span class="arg">img</span>.blur_channel(<span class=
|
1949
|
+
"arg">radius=0.0</span>, <span class=
|
1950
|
+
"arg">sigma=1.0</span><span class="arg">[, channel...]]</span>)
|
1951
|
+
-> <em>image</em></p>
|
1952
|
+
</div>
|
1953
|
+
|
1954
|
+
<div class="desc">
|
1955
|
+
<h4>Description</h4>
|
1956
|
+
|
1957
|
+
<p>Blurs the specified channel. <span class="imquote">We
|
1958
|
+
convolve the image with a Gaussian operator of the given radius
|
1959
|
+
and standard deviation (sigma) . The <code>blur_channel</code>
|
1960
|
+
method differs from <a href=
|
1961
|
+
"image2.html#gaussian_blur_channel">gaussian_blur_channel</a>
|
1962
|
+
in that it uses a separable kernel which is faster but
|
1963
|
+
mathematically equivalent to the non-separable
|
1964
|
+
kernel.</span></p>
|
1965
|
+
|
1966
|
+
<h4>Arguments</h4>
|
1967
|
+
|
1968
|
+
<p class="imquote">For reasonable results, the <span class=
|
1969
|
+
"arg">radius</span> should be larger than <span class=
|
1970
|
+
"arg">sigma</span>. Use a radius of 0 and
|
1971
|
+
<code>blur_channel</code> selects a suitable radius for
|
1972
|
+
you.</p>
|
1973
|
+
|
1974
|
+
<dl>
|
1975
|
+
<dt>channel...</dt>
|
1976
|
+
|
1977
|
+
<dd>One or more <a href=
|
1978
|
+
"constants.html#ChannelType">ChannelType</a> values. If none
|
1979
|
+
are specified, the red, green, and blue channels are blurred.
|
1980
|
+
This is the equivalent of <a href=
|
1981
|
+
"#blur_image">blur_image</a>.</dd>
|
1982
|
+
</dl>
|
1983
|
+
|
1984
|
+
<h4>Returns</h4>
|
1985
|
+
|
1986
|
+
<p>A new image</p>
|
1987
|
+
|
1988
|
+
<h4>See also</h4>
|
1989
|
+
|
1990
|
+
<p><a href="#blur_image">blur_image</a>, <a href=
|
1991
|
+
"image2.html#gaussian_blur_channel">gaussian_blur_channel</a>,
|
1992
|
+
<a href="image2.html#motion_blur">motion_blur</a>, <a href=
|
1993
|
+
"image3.html#radial_blur">radial_blur</a>, <a href=
|
1994
|
+
"image3.html#selective_blur_channel">selective_blur_channel</a></p>
|
1995
|
+
|
1996
|
+
<h4>Magick API</h4>
|
1997
|
+
|
1998
|
+
<p>BlurImageChannel</p>
|
1999
|
+
</div>
|
2000
|
+
|
2001
|
+
<div class="sig">
|
2002
|
+
<h3 id="blur_image">blur_image</h3>
|
2003
|
+
|
2004
|
+
<p><span class="arg">img</span>.blur_image(<span class=
|
2005
|
+
"arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0)
|
2006
|
+
-> <em>image</em></p>
|
2007
|
+
</div>
|
2008
|
+
|
2009
|
+
<div class="desc">
|
2010
|
+
<h4>Description</h4>
|
2011
|
+
|
2012
|
+
<p>Blurs the image. <span class="imquote">We convolve the image
|
2013
|
+
with a Gaussian operator of the given radius and standard
|
2014
|
+
deviation (sigma).</span></p>
|
2015
|
+
|
2016
|
+
<h4>Arguments</h4>
|
2017
|
+
|
2018
|
+
<p class="imquote">For reasonable results, the <span class=
|
2019
|
+
"arg">radius</span> should be larger than <span class=
|
2020
|
+
"arg">sigma</span>. Use a <span class="arg">radius</span> of 0
|
2021
|
+
and <code>blur_image</code> selects a suitable <span class=
|
2022
|
+
"arg">radius</span> for you.</p>
|
2023
|
+
|
2024
|
+
<h4>Returns</h4>
|
2025
|
+
|
2026
|
+
<p>A new image.</p>
|
2027
|
+
|
2028
|
+
<h4>Example</h4>
|
2029
|
+
|
2030
|
+
<p class="rollover"><a href=
|
2031
|
+
"javascript:popup('blur_image.rb.html')"><img onmouseover=
|
2032
|
+
"this.src='ex/images/Flower_Hat.jpg'" onmouseout=
|
2033
|
+
"this.src='ex/blur_image.jpg'" src="ex/blur_image.jpg" alt=
|
2034
|
+
"blur_image example" title=
|
2035
|
+
"Click to see the example script" /></a> <img src=
|
2036
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
2037
|
+
"Mouse over the example to see the original image" /></p>
|
2038
|
+
|
2039
|
+
<h4>See also</h4>
|
2040
|
+
|
2041
|
+
<p><a href="#blur_channel">blur_channel</a>, <a href=
|
2042
|
+
"image2.html#gaussian_blur">gaussian_blur</a>, <a href=
|
2043
|
+
"image2.html#motion_blur">motion_blur</a>, <a href=
|
2044
|
+
"image3.html#radial_blur">radial_blur</a>, <a href=
|
2045
|
+
"image3.html#selective_blur_channel">selective_blur_channel</a></p>
|
2046
|
+
|
2047
|
+
<h4>Magick API</h4>
|
2048
|
+
|
2049
|
+
<p>BlurImage</p>
|
2050
|
+
</div>
|
2051
|
+
|
2052
|
+
<div class="sig">
|
2053
|
+
<h3 id="border">border</h3>
|
2054
|
+
|
2055
|
+
<p><span class="arg">img</span>.border(<span class=
|
2056
|
+
"arg">width</span>, <span class="arg">height</span>,
|
2057
|
+
<span class="arg">color</span>) -> <em>image</em></p>
|
2058
|
+
</div>
|
2059
|
+
|
2060
|
+
<div class="desc">
|
2061
|
+
<h4>Description</h4>
|
2062
|
+
|
2063
|
+
<p>Add a border around the image.</p>
|
2064
|
+
|
2065
|
+
<h4>Arguments</h4>
|
2066
|
+
|
2067
|
+
<dl>
|
2068
|
+
<dt>width</dt>
|
2069
|
+
|
2070
|
+
<dd>Border width in pixels</dd>
|
2071
|
+
|
2072
|
+
<dt>height</dt>
|
2073
|
+
|
2074
|
+
<dd>Border height in pixels</dd>
|
2075
|
+
|
2076
|
+
<dt>color</dt>
|
2077
|
+
|
2078
|
+
<dd>Border color. Use a <a href=
|
2079
|
+
"imusage.html#color_names">named color</a> or a <a href=
|
2080
|
+
"struct.html#Pixel">pixel</a> object.</dd>
|
2081
|
+
</dl>
|
2082
|
+
|
2083
|
+
<h4>Returns</h4>
|
2084
|
+
|
2085
|
+
<p>A new image</p>
|
2086
|
+
|
2087
|
+
<h4>Example</h4>
|
2088
|
+
|
2089
|
+
<p class="rollover"><a href=
|
2090
|
+
"javascript:popup('border.rb.html')"><img style=
|
2091
|
+
"padding: 10px; display: none;" id="borderless" onmouseout=
|
2092
|
+
"this.style.display='none'; bordered.style.display='';" src=
|
2093
|
+
"ex/images/Flower_Hat.jpg" alt="border example" title=
|
2094
|
+
"Click to see the example script" /> <img id="bordered"
|
2095
|
+
onmouseover=
|
2096
|
+
"this.style.display='none'; borderless.style.display='';" src=
|
2097
|
+
"ex/border.jpg" alt="border example" /></a><img src=
|
2098
|
+
"ex/images/spin.gif" alt="" class="spin" style="left: 224px;"
|
2099
|
+
title="Mouse over the example to see the original image" /></p>
|
2100
|
+
|
2101
|
+
<h4>See also</h4>
|
2102
|
+
|
2103
|
+
<p><a href="#border_bang">border!</a>, <a href=
|
2104
|
+
"image2.html#frame">frame</a></p>
|
2105
|
+
|
2106
|
+
<h4>Magick API</h4>
|
2107
|
+
|
2108
|
+
<p>BorderImage</p>
|
2109
|
+
</div>
|
2110
|
+
|
2111
|
+
<div class="sig">
|
2112
|
+
<h3 id="border_bang">border!</h3>
|
2113
|
+
|
2114
|
+
<p><span class="arg">img</span>.border!(<span class=
|
2115
|
+
"arg">width</span>, <span class="arg">height</span>,
|
2116
|
+
<span class="arg">color</span>) -> <em>self</em></p>
|
2117
|
+
</div>
|
2118
|
+
|
2119
|
+
<div class="desc">
|
2120
|
+
<h4>Description</h4>
|
2121
|
+
|
2122
|
+
<p>In-place form of <a href="#border">border</a></p>
|
2123
|
+
|
2124
|
+
<h4>Returns</h4>
|
2125
|
+
|
2126
|
+
<p>self</p>
|
2127
|
+
</div>
|
2128
|
+
|
2129
|
+
<div class="sig">
|
2130
|
+
<h3 id="bounding_box">bounding_box</h3>
|
2131
|
+
|
2132
|
+
<p><span class="arg">img</span>.bounding_box ->
|
2133
|
+
<em>rectangle</em></p>
|
2134
|
+
</div>
|
2135
|
+
|
2136
|
+
<div class="desc">
|
2137
|
+
<h4>Description</h4>
|
2138
|
+
|
2139
|
+
<p>The image's <em>bounding box</em>. The bounding box is the
|
2140
|
+
rectangle that encloses all the pixels not in the border color.
|
2141
|
+
Uses the current <a href="imageattrs.html#fuzz">fuzz</a>
|
2142
|
+
value.</p>
|
2143
|
+
|
2144
|
+
<h4>Returns</h4>A <a href="struct.html#Rectangle">Rectangle</a>
|
2145
|
+
object.
|
2146
|
+
|
2147
|
+
<h4>Example</h4>
|
2148
|
+
|
2149
|
+
<p>In this example, the bounding box is the gray square
|
2150
|
+
enclosing the blue circle. (The coordinates and red circles
|
2151
|
+
were added after the bounding box was computed.)</p>
|
2152
|
+
|
2153
|
+
<p><a href="javascript:popup('bounding_box.rb.html')"><img src=
|
2154
|
+
"ex/bounding_box.gif" alt="ex/bounding_box.rb" title=
|
2155
|
+
"Click to see the example script" /></a></p>
|
2156
|
+
</div>
|
2157
|
+
|
2158
|
+
<div class="sig">
|
2159
|
+
<h3 id="change_geometry">change_geometry</h3>
|
2160
|
+
|
2161
|
+
<p><span class="arg">img</span>.change_geometry(<span class=
|
2162
|
+
"arg">string</span>) {|cols,rows,image| <span class=
|
2163
|
+
"arg">block</span>} -> <em>??? (see Returns)</em><br />
|
2164
|
+
<span class="arg">img.change_geometry</span>(<span class=
|
2165
|
+
"arg">geometry</span>) {|cols,rows,image| <span class=
|
2166
|
+
"arg">block</span>} -> <em>??? (see Returns)</em></p>
|
2167
|
+
</div>
|
2168
|
+
|
2169
|
+
<div class="desc">
|
2170
|
+
<h4>Description</h4>
|
2171
|
+
|
2172
|
+
<p>The <code>change_geometry</code> method supports resizing a
|
2173
|
+
method by specifying constraints. For example, you can specify
|
2174
|
+
that the image should be resized such that the aspect ratio
|
2175
|
+
should be retained but the resulting image should be no larger
|
2176
|
+
than 640 pixels wide and 480 pixels tall.</p>
|
2177
|
+
|
2178
|
+
<p>The argument may be either a <a href=
|
2179
|
+
"imusage.html#geometry">geometry string</a> or a <a href=
|
2180
|
+
"struct.html#Geometry">Geometry</a> object.
|
2181
|
+
<code>Change_geometry</code> yields to the block, passing new
|
2182
|
+
width and height values based on the argument with respect to
|
2183
|
+
<code>self</code>. The return value is the return value of the
|
2184
|
+
block.</p>
|
2185
|
+
|
2186
|
+
<h4>Arguments</h4>An <a href="imusage.html#geometry">geometry
|
2187
|
+
string</a> or a <code>Geometry</code> object
|
2188
|
+
|
2189
|
+
<h4>Returns</h4>
|
2190
|
+
|
2191
|
+
<p>The value returned by the block</p>
|
2192
|
+
|
2193
|
+
<h4>Example</h4>
|
2194
|
+
<pre>
|
2195
|
+
mona = Image.read('MonaLisa.jpg').first
|
2196
|
+
mona.change_geometry!('320x240') { |cols, rows, img|
|
2197
|
+
img.resize!(cols, rows)
|
2198
|
+
}
|
2199
|
+
</pre>
|
2200
|
+
|
2201
|
+
<h4>Magick API</h4>
|
2202
|
+
|
2203
|
+
<p>ParseSizeString</p>
|
2204
|
+
|
2205
|
+
<h4>Note</h4>
|
2206
|
+
|
2207
|
+
<p><code>change_geometry!</code> is an alias for
|
2208
|
+
<code>change_geometry</code>.</p>
|
2209
|
+
</div>
|
2210
|
+
|
2211
|
+
<div class="sig">
|
2212
|
+
<h3 id="changed_q">changed?</h3>
|
2213
|
+
|
2214
|
+
<p><span class="arg">img</span>.changed? ->
|
2215
|
+
<code>true</code> or <code>false</code></p>
|
2216
|
+
</div>
|
2217
|
+
|
2218
|
+
<div class="desc">
|
2219
|
+
<h4>Description</h4>Returns <code>true</code> if any pixel has
|
2220
|
+
been altered since the image was constituted.
|
2221
|
+
|
2222
|
+
<h4>Magick API</h4>
|
2223
|
+
|
2224
|
+
<p>IsTaintImage</p>
|
2225
|
+
</div>
|
2226
|
+
|
2227
|
+
<div class="sig">
|
2228
|
+
<h3 id="channel">channel</h3>
|
2229
|
+
|
2230
|
+
<p><span class="arg">img</span>.channel(<span class=
|
2231
|
+
"arg">channel</span>) -> <em>image</em></p>
|
2232
|
+
</div>
|
2233
|
+
|
2234
|
+
<div class="desc">
|
2235
|
+
<h4>Description</h4>
|
2236
|
+
|
2237
|
+
<p>Extracts a channel from the image. <span class="imquote">A
|
2238
|
+
channel is a particular color component of each pixel in the
|
2239
|
+
[image].</span></p>
|
2240
|
+
|
2241
|
+
<h4>Arguments</h4>
|
2242
|
+
|
2243
|
+
<p>A <a href="constants.html#ChannelType">ChannelType</a>
|
2244
|
+
value.</p>
|
2245
|
+
|
2246
|
+
<h4>Returns</h4>
|
2247
|
+
|
2248
|
+
<p>An image in which the RGB values of all the pixels have been
|
2249
|
+
set to a gray corresponding to the specified channel value. For
|
2250
|
+
example, given a pixel in the original image with the value
|
2251
|
+
R=255, G=128, B=0 and the RedChannel argument, the equivalent
|
2252
|
+
pixel in the result image will have the value R=255, G=255, and
|
2253
|
+
B=255. For the BlueChannel argument, the pixel would have the
|
2254
|
+
value R=0, G=0, B=0.</p>
|
2255
|
+
|
2256
|
+
<h4>Example</h4>
|
2257
|
+
|
2258
|
+
<p>The channel image preserves the tone of the selected RGB
|
2259
|
+
component.</p>
|
2260
|
+
|
2261
|
+
<p><a href="javascript:popup('channel.rb.html')"><img src=
|
2262
|
+
"ex/channel.jpg" alt="channel example" /></a></p>
|
2263
|
+
|
2264
|
+
<h4>Magick API</h4>
|
2265
|
+
|
2266
|
+
<p>ChannelImage</p>
|
2267
|
+
</div>
|
2268
|
+
|
2269
|
+
<div class="sig">
|
2270
|
+
<h3 id="channel_depth">channel_depth</h3>
|
2271
|
+
|
2272
|
+
<p><span class="arg">img</span>.channel_depth([<span class=
|
2273
|
+
"arg">channel</span>...]) -> <em>number</em></p>
|
2274
|
+
</div>
|
2275
|
+
|
2276
|
+
<div class="desc">
|
2277
|
+
<h4>Description</h4>
|
2278
|
+
|
2279
|
+
<p>Returns the maximum depth for the specified channel or
|
2280
|
+
channels.</p>
|
2281
|
+
|
2282
|
+
<h4>Arguments</h4>
|
2283
|
+
|
2284
|
+
<dl>
|
2285
|
+
<dt>channel...</dt>
|
2286
|
+
|
2287
|
+
<dd>Zero or more <a href=
|
2288
|
+
"constants.html#ChannelType">ChannelType</a> values. If no
|
2289
|
+
arguments are specified, the default is all channels.</dd>
|
2290
|
+
</dl>
|
2291
|
+
|
2292
|
+
<h4>Returns</h4>
|
2293
|
+
|
2294
|
+
<p>The maximum depth</p>
|
2295
|
+
|
2296
|
+
<h4>See also</h4>
|
2297
|
+
|
2298
|
+
<p><a href=
|
2299
|
+
"image3.html#set_channel_depth">set_channel_depth</a></p>
|
2300
|
+
|
2301
|
+
<h4>Magick API</h4>
|
2302
|
+
|
2303
|
+
<p>GetImageChannelDepth</p>
|
2304
|
+
</div>
|
2305
|
+
|
2306
|
+
<div class="sig">
|
2307
|
+
<h3 id="channel_extrema">channel_extrema</h3>
|
2308
|
+
|
2309
|
+
<p><span class="arg">img</span>.channel_extrema([<span class=
|
2310
|
+
"arg">channel</span>...]) -> <em>[number, number]</em></p>
|
2311
|
+
</div>
|
2312
|
+
|
2313
|
+
<div class="desc">
|
2314
|
+
<h4>Description</h4>
|
2315
|
+
|
2316
|
+
<p>Returns the minimum and maximum intensity values for the
|
2317
|
+
specified channel or channels.</p>
|
2318
|
+
|
2319
|
+
<h4>Arguments</h4>
|
2320
|
+
|
2321
|
+
<dl>
|
2322
|
+
<dt>channel...</dt>
|
2323
|
+
|
2324
|
+
<dd>Zero or more <a href=
|
2325
|
+
"constants.html#ChannelType">ChannelType</a> values. If no
|
2326
|
+
arguments are specified, the default is all channels.</dd>
|
2327
|
+
</dl>
|
2328
|
+
|
2329
|
+
<h4>Returns</h4>
|
2330
|
+
|
2331
|
+
<p>An array. The first element in the array is the minimum
|
2332
|
+
value. The second element is the maximum value.</p>
|
2333
|
+
|
2334
|
+
<h4>Magick API</h4>
|
2335
|
+
|
2336
|
+
<p>GetImageChannelExtrema</p>
|
2337
|
+
</div>
|
2338
|
+
|
2339
|
+
<div class="sig">
|
2340
|
+
<h3 id="channel_mean">channel_mean</h3>
|
2341
|
+
|
2342
|
+
<p><span class="arg">img</span>.channel_mean([<span class=
|
2343
|
+
"arg">channel</span>...]) -> <em>[number, number]</em></p>
|
2344
|
+
</div>
|
2345
|
+
|
2346
|
+
<div class="desc">
|
2347
|
+
<h4>Description</h4>
|
2348
|
+
|
2349
|
+
<p>Returns the mean and standard deviation values for the
|
2350
|
+
specified channel or channels.</p>
|
2351
|
+
|
2352
|
+
<h4>Arguments</h4>
|
2353
|
+
|
2354
|
+
<dl>
|
2355
|
+
<dt>channel...</dt>
|
2356
|
+
|
2357
|
+
<dd>Zero or more <a href=
|
2358
|
+
"constants.html#ChannelType">ChannelType</a> values. If no
|
2359
|
+
arguments are specified, the default is all channels.</dd>
|
2360
|
+
</dl>
|
2361
|
+
|
2362
|
+
<h4>Returns</h4>
|
2363
|
+
|
2364
|
+
<p>An array. The first element in the array is the mean value.
|
2365
|
+
The second element is the standard deviation.</p>
|
2366
|
+
|
2367
|
+
<h4>Magick API</h4>
|
2368
|
+
|
2369
|
+
<p>GetImageChannelMean</p>
|
2370
|
+
</div>
|
2371
|
+
|
2372
|
+
<div class="sig">
|
2373
|
+
<h3 id="charcoal">charcoal</h3>
|
2374
|
+
|
2375
|
+
<p><span class="arg">img</span>.charcoal(<span class=
|
2376
|
+
"arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0)
|
2377
|
+
-> <em>image</em></p>
|
2378
|
+
</div>
|
2379
|
+
|
2380
|
+
<div class="desc">
|
2381
|
+
<h4>Description</h4>
|
2382
|
+
|
2383
|
+
<p>Adds a "charcoal" effect to the image. You can alter the
|
2384
|
+
intensity of the effect by changing the <span class=
|
2385
|
+
"arg">radius</span> and <span class="arg">sigma</span>
|
2386
|
+
arguments.</p>
|
2387
|
+
|
2388
|
+
<h4>Arguments</h4>
|
2389
|
+
|
2390
|
+
<dl>
|
2391
|
+
<dt>radius</dt>
|
2392
|
+
|
2393
|
+
<dd class="imquote">The radius of the pixel
|
2394
|
+
neighborhood.</dd>
|
2395
|
+
|
2396
|
+
<dt>sigma</dt>
|
2397
|
+
|
2398
|
+
<dd class="imquote">The standard deviation of the Gaussian,
|
2399
|
+
in pixels.</dd>
|
2400
|
+
</dl>
|
2401
|
+
|
2402
|
+
<h4>Returns</h4>
|
2403
|
+
|
2404
|
+
<p>A new image</p>
|
2405
|
+
|
2406
|
+
<h4>Example</h4>
|
2407
|
+
|
2408
|
+
<p class="rollover"><a href=
|
2409
|
+
"javascript:popup('charcoal.rb.html')"><img onmouseover=
|
2410
|
+
"this.src='ex/images/Flower_Hat.jpg'" onmouseout=
|
2411
|
+
"this.src='ex/charcoal.jpg'" src="ex/charcoal.jpg" alt=
|
2412
|
+
"charcoal example" title=
|
2413
|
+
"Click the image to see the example script" /></a> <img src=
|
2414
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
2415
|
+
"Mouse over the example to see the original image" /></p>
|
2416
|
+
|
2417
|
+
<h4>Magick API</h4>
|
2418
|
+
|
2419
|
+
<p>CharcoalImage</p>
|
2420
|
+
</div>
|
2421
|
+
|
2422
|
+
<div class="sig">
|
2423
|
+
<h3 id="check_destroyed">check_destroyed</h3>
|
2424
|
+
|
2425
|
+
<p><span class="arg">img</span>.check_destroyed ->
|
2426
|
+
<code>nil</code></p>
|
2427
|
+
</div>
|
2428
|
+
|
2429
|
+
<div class="desc">
|
2430
|
+
<h4>Description</h4>
|
2431
|
+
|
2432
|
+
<p>Raises DestroyedImageError if the image has been destroyed.
|
2433
|
+
Returns nil otherwise.</p>
|
2434
|
+
|
2435
|
+
<h4>See also</h4>
|
2436
|
+
|
2437
|
+
<p><a href="#destroy_bang">destroy!</a>, <a href=
|
2438
|
+
"#destroyed_q">destroyed?</a></p>
|
2439
|
+
</div>
|
2440
|
+
|
2441
|
+
<div class="sig">
|
2442
|
+
<h3 id="chop">chop</h3>
|
2443
|
+
|
2444
|
+
<p><span class="arg">img</span>.chop(<span class=
|
2445
|
+
"arg">x</span>, <span class="arg">y</span>, <span class=
|
2446
|
+
"arg">width</span>, <span class="arg">height</span>) ->
|
2447
|
+
<em>image</em></p>
|
2448
|
+
</div>
|
2449
|
+
|
2450
|
+
<div class="desc">
|
2451
|
+
<h4>Description</h4>
|
2452
|
+
|
2453
|
+
<p>Removes the specified rectangle and collapses the rest of
|
2454
|
+
the image to fill the removed portion.</p>
|
2455
|
+
|
2456
|
+
<h4>Arguments</h4>
|
2457
|
+
|
2458
|
+
<dl>
|
2459
|
+
<dt>x</dt>
|
2460
|
+
|
2461
|
+
<dd>The x offset of the rectangle from the upper-left corner
|
2462
|
+
of the image.</dd>
|
2463
|
+
|
2464
|
+
<dt>y</dt>
|
2465
|
+
|
2466
|
+
<dd>The y offset of the rectangle from the upper-left corner
|
2467
|
+
of the image.</dd>
|
2468
|
+
|
2469
|
+
<dt>width</dt>
|
2470
|
+
|
2471
|
+
<dd>The width of the rectangle.</dd>
|
2472
|
+
|
2473
|
+
<dt>height</dt>
|
2474
|
+
|
2475
|
+
<dd>The height of the rectangle.</dd>
|
2476
|
+
</dl>
|
2477
|
+
|
2478
|
+
<h4>Returns</h4>
|
2479
|
+
|
2480
|
+
<p>A new image</p>
|
2481
|
+
|
2482
|
+
<h4>Example</h4>
|
2483
|
+
|
2484
|
+
<p>The chop rectangle is highlighted in the "before" image. The
|
2485
|
+
result may seem counter-intuitive!</p>
|
2486
|
+
|
2487
|
+
<p class="rollover"><a href=
|
2488
|
+
"javascript:popup('chop.rb.html')"><img onmouseover=
|
2489
|
+
"this.src='ex/chop_before.jpg'" onmouseout=
|
2490
|
+
"this.src='ex/chop_after.jpg'" src="ex/chop_after.jpg" alt=
|
2491
|
+
"chop example" title=
|
2492
|
+
"Click the image to see the example script" /></a> <img src=
|
2493
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
2494
|
+
"Mouse over the example to see the original image" /></p>
|
2495
|
+
|
2496
|
+
<h4>See also</h4>
|
2497
|
+
|
2498
|
+
<p><a href="#crop">crop</a></p>
|
2499
|
+
|
2500
|
+
<h4>Magick API</h4>
|
2501
|
+
|
2502
|
+
<p>ChopImage</p>
|
2503
|
+
</div>
|
2504
|
+
|
2505
|
+
<div class="sig">
|
2506
|
+
<h3 id="clone">clone</h3>
|
2507
|
+
|
2508
|
+
<p><span class="arg">img</span>.clone -> <em>image</em></p>
|
2509
|
+
</div>
|
2510
|
+
|
2511
|
+
<div class="desc">
|
2512
|
+
<h4>Description</h4>
|
2513
|
+
|
2514
|
+
<p>Same as <a href="#dup">dup</a> except the frozen state of
|
2515
|
+
the original is propagated to the new copy.</p>
|
2516
|
+
|
2517
|
+
<h4>Returns</h4>
|
2518
|
+
|
2519
|
+
<p>A new image</p>
|
2520
|
+
|
2521
|
+
<h4>See also</h4>
|
2522
|
+
|
2523
|
+
<p><a href="#dup">dup</a></p>
|
2524
|
+
</div>
|
2525
|
+
|
2526
|
+
<div class="sig">
|
2527
|
+
<h3 id="clut_channel">clut_channel</h3>
|
2528
|
+
|
2529
|
+
<p><span class="arg">img</span>.clut(<span class=
|
2530
|
+
"arg">clut_image</span> [, <span class=
|
2531
|
+
"arg">channel...</span>]) -> <em>self</em></p>
|
2532
|
+
</div>
|
2533
|
+
|
2534
|
+
<div class="desc">
|
2535
|
+
<h4>Description</h4>
|
2536
|
+
|
2537
|
+
<p>Replace the channel values in the target image with a lookup
|
2538
|
+
of its replacement value in an LUT gradient image.</p>
|
2539
|
+
|
2540
|
+
<p class="imquote">The LUT image should be either a single row
|
2541
|
+
or column image of replacement colors. The lookup is controlled
|
2542
|
+
by the -interpolate setting, especially for an LUT which is not
|
2543
|
+
the full length needed by the IM installed Quality (Q) level.
|
2544
|
+
Good settings for this is the default 'bilinear' or 'bicubic'
|
2545
|
+
interpolation setting for a smooth color gradient, or 'integer'
|
2546
|
+
for a direct unsmoothed lookup of color values.</p>
|
2547
|
+
|
2548
|
+
<p class="imquote">This method is especially suited to
|
2549
|
+
replacing a grayscale image with specific color gradient from
|
2550
|
+
the CLUT image.</p>
|
2551
|
+
|
2552
|
+
<p class="imquote">Note that color replacements involving
|
2553
|
+
transparency (alpha/matte channel) will lookup the replacement
|
2554
|
+
alpha/matte value using the alpha/matte value of the original
|
2555
|
+
image. As such correct alpha channel lookup for a pure
|
2556
|
+
gray-scale original image will require a copy of that grayscale
|
2557
|
+
to be transferred into its alpha channel before applying the
|
2558
|
+
-clut operator.</p>
|
2559
|
+
|
2560
|
+
<h4>Arguments</h4>
|
2561
|
+
|
2562
|
+
<dl>
|
2563
|
+
<dt>clut_image</dt>
|
2564
|
+
|
2565
|
+
<dd>The LUT gradient image. Specify which interpolation
|
2566
|
+
method to use by setting this image's <a href=
|
2567
|
+
"imageattrs.html#pixel_interpolation_method">pixel_interpolation_method</a>
|
2568
|
+
attribute to a <a href=
|
2569
|
+
"constants.html#InterpolatePixelMethod">InterpolatePixelMethod</a>
|
2570
|
+
value.</dd>
|
2571
|
+
|
2572
|
+
<dt>channel...</dt>
|
2573
|
+
|
2574
|
+
<dd>Limit which channels are modified by specifying one or
|
2575
|
+
more <a href="constants.html#ChannelType">ChannelType</a>
|
2576
|
+
values. Only these channels will be changed. If no channels
|
2577
|
+
are specified, all channels will be changed.</dd>
|
2578
|
+
</dl>
|
2579
|
+
|
2580
|
+
<h4>Returns</h4>
|
2581
|
+
|
2582
|
+
<p>self</p>
|
2583
|
+
|
2584
|
+
<h4>See also</h4>
|
2585
|
+
|
2586
|
+
<p>ImageMagick's -clut option.</p>
|
2587
|
+
</div>
|
2588
|
+
|
2589
|
+
<div class="sig">
|
2590
|
+
<h3 id="color_fill_to_border">color_fill_to_border</h3>
|
2591
|
+
|
2592
|
+
<p><span class=
|
2593
|
+
"arg">img</span>.color_fill_to_border(<span class=
|
2594
|
+
"arg">x</span>, <span class="arg">y</span>, <span class=
|
2595
|
+
"arg">fill_color</span>) -> <em>image</em></p>
|
2596
|
+
</div>
|
2597
|
+
|
2598
|
+
<div class="desc">
|
2599
|
+
<h4>Description</h4>
|
2600
|
+
|
2601
|
+
<p>Changes any pixel that is a neighbor of the target pixel and
|
2602
|
+
is not the border color to the fill color.</p>
|
2603
|
+
|
2604
|
+
<h4>Arguments</h4>
|
2605
|
+
|
2606
|
+
<dl>
|
2607
|
+
<dt>x, y</dt>
|
2608
|
+
|
2609
|
+
<dd>The target pixel's location.</dd>
|
2610
|
+
|
2611
|
+
<dt>fill_color</dt>
|
2612
|
+
|
2613
|
+
<dd>The fill color. The fill color can be either color name
|
2614
|
+
or a <a href="struct.html#Pixel">Pixel</a> object.</dd>
|
2615
|
+
</dl>
|
2616
|
+
|
2617
|
+
<h4>Returns</h4>
|
2618
|
+
|
2619
|
+
<p>A new image</p>
|
2620
|
+
|
2621
|
+
<h4>Example</h4>
|
2622
|
+
|
2623
|
+
<p>In this example, the aquamarine fill starts at the center of
|
2624
|
+
the circle and fills to the black border. All non-black pixels
|
2625
|
+
are replaced by the fill color. Contrast the result of
|
2626
|
+
<code>color_fill_to_border</code> with that of
|
2627
|
+
<code>color_floodfill</code> example, below.</p>
|
2628
|
+
|
2629
|
+
<p class="rollover"><a href=
|
2630
|
+
"javascript:popup('color_fill_to_border.rb.html')"><img onmouseover="this.src='ex/color_fill_to_border_before.gif'"
|
2631
|
+
onmouseout="this.src='ex/color_fill_to_border_after.gif'" src=
|
2632
|
+
"ex/color_fill_to_border_after.gif" alt=
|
2633
|
+
"color_fill_to_border example" title=
|
2634
|
+
"Click the image to see the example script" /></a><img src=
|
2635
|
+
"ex/images/spin.gif" alt="" class="spin" style=
|
2636
|
+
"margin-bottom: 182px; margin-left: 4px;" title=
|
2637
|
+
"Mouse over the example to see the original image" /></p>
|
2638
|
+
|
2639
|
+
<h4>See also</h4>
|
2640
|
+
|
2641
|
+
<p><a href="#color_floodfill">color_floodfill</a></p>
|
2642
|
+
|
2643
|
+
<h4>Magick API</h4>
|
2644
|
+
|
2645
|
+
<p>ColorFloodfillImage</p>
|
2646
|
+
</div>
|
2647
|
+
|
2648
|
+
<div class="sig">
|
2649
|
+
<h3 id="color_floodfill">color_floodfill</h3>
|
2650
|
+
|
2651
|
+
<p><span class="arg">img</span>.color_floodfill(<span class=
|
2652
|
+
"arg">x</span>, <span class="arg">y</span>, <span class=
|
2653
|
+
"arg">fill_color</span>) -> <em>image</em></p>
|
2654
|
+
</div>
|
2655
|
+
|
2656
|
+
<div class="desc">
|
2657
|
+
<h4>Description</h4>
|
2658
|
+
|
2659
|
+
<p>Changes any pixel that is the same color and is a neighbor
|
2660
|
+
of the target pixel to the fill color.</p>
|
2661
|
+
|
2662
|
+
<h4>Arguments</h4>
|
2663
|
+
|
2664
|
+
<dl>
|
2665
|
+
<dt>x, y</dt>
|
2666
|
+
|
2667
|
+
<dd>The target pixel's location.</dd>
|
2668
|
+
|
2669
|
+
<dt>fill_color</dt>
|
2670
|
+
|
2671
|
+
<dd>The fill color, either color name or a <a href=
|
2672
|
+
"struct.html#Pixel">Pixel</a> object.</dd>
|
2673
|
+
</dl>
|
2674
|
+
|
2675
|
+
<h4>Returns</h4>
|
2676
|
+
|
2677
|
+
<p>A new image</p>
|
2678
|
+
|
2679
|
+
<h4>Example</h4>
|
2680
|
+
|
2681
|
+
<p>In this example, the aquamarine fill starts at the center of
|
2682
|
+
the circle and replaces all neighboring white pixels. Contrast
|
2683
|
+
the result of <code>color_floodfill</code> with that of
|
2684
|
+
<code>color_fill_to_border</code>, above.</p>
|
2685
|
+
|
2686
|
+
<p class="rollover"><a href=
|
2687
|
+
"javascript:popup('color_floodfill.rb.html')"><img onmouseover=
|
2688
|
+
"this.src='ex/color_floodfill_before.gif'" onmouseout=
|
2689
|
+
"this.src='ex/color_floodfill_after.gif'" src=
|
2690
|
+
"ex/color_floodfill_after.gif" alt="color_floodfill example"
|
2691
|
+
title="Click the image to see the example script" /></a>
|
2692
|
+
<img src="ex/images/spin.gif" alt="" class="spin" style=
|
2693
|
+
"margin-bottom: 182px;" title=
|
2694
|
+
"Mouse over the example to see the original image" /></p>
|
2695
|
+
|
2696
|
+
<h4>See also</h4>
|
2697
|
+
|
2698
|
+
<p><a href="#color_fill_to_border">color_fill_to_border</a>,
|
2699
|
+
<a href="image2.html#opaque">opaque</a></p>
|
2700
|
+
|
2701
|
+
<h4>Magick API</h4>
|
2702
|
+
|
2703
|
+
<p>ColorFloodfillImage</p>
|
2704
|
+
</div>
|
2705
|
+
|
2706
|
+
<div class="sig">
|
2707
|
+
<h3 id="color_histogram">color_histogram</h3>
|
2708
|
+
|
2709
|
+
<p><span class="arg">img</span>.color_histogram() ->
|
2710
|
+
<em>hash</em></p>
|
2711
|
+
</div>
|
2712
|
+
|
2713
|
+
<div class="desc">
|
2714
|
+
<h4>Description</h4>
|
2715
|
+
|
2716
|
+
<p>Computes the number of times each unique color appears in
|
2717
|
+
the image.</p>
|
2718
|
+
|
2719
|
+
<h4>Returns</h4>
|
2720
|
+
|
2721
|
+
<p>A hash. Each key in the hash is a <a href=
|
2722
|
+
"struct.html#Pixel">pixel</a> representing a color that appears
|
2723
|
+
in the image. The value associated with the key is the number
|
2724
|
+
of times that color appears in the image. <em>Caution:</em> if
|
2725
|
+
the image contains many colors the hash will be very large. You
|
2726
|
+
may want to use the <a href="image3.html#quantize">quantize</a>
|
2727
|
+
method to reduce the number of colors before using
|
2728
|
+
<code>color_histogram</code>.</p>
|
2729
|
+
|
2730
|
+
<h4>Example</h4>
|
2731
|
+
|
2732
|
+
<p>This histogram was produced by sorting the hash returned by
|
2733
|
+
<code>color_histogram</code> by increasing frequency.</p>
|
2734
|
+
|
2735
|
+
<p><a href=
|
2736
|
+
"javascript:popup('color_histogram.rb.html')"><img src=
|
2737
|
+
"ex/color_histogram.gif" alt="color_histogram example" title=
|
2738
|
+
"Click the image to see the example script" /></a></p>
|
2739
|
+
|
2740
|
+
<h4>Magick API</h4>
|
2741
|
+
|
2742
|
+
<p>GetImageHistogram</p>
|
2743
|
+
</div>
|
2744
|
+
|
2745
|
+
<div class="sig">
|
2746
|
+
<h3 id="colorize">colorize</h3>
|
2747
|
+
|
2748
|
+
<p><span class="arg">img</span>.colorize(<span class=
|
2749
|
+
"arg">red_pct</span>, <span class="arg">green_pct</span>,
|
2750
|
+
<span class="arg">blue_pct</span>, [<span class=
|
2751
|
+
"arg">matte_pct</span>, ] <span class="arg">fill</span>) ->
|
2752
|
+
<em>image</em></p>
|
2753
|
+
</div>
|
2754
|
+
|
2755
|
+
<div class="desc">
|
2756
|
+
<h4>Description</h4>
|
2757
|
+
|
2758
|
+
<p>Blend the fill color with the image pixels. The red_pct,
|
2759
|
+
green_pct, blue_pct and matte_pct arguments are the percentage
|
2760
|
+
to blend with the red, green, blue and matte channels.</p>
|
2761
|
+
|
2762
|
+
<h4>Arguments</h4>
|
2763
|
+
|
2764
|
+
<dl>
|
2765
|
+
<dt>red_pct, green_pct, blue_pct, matte_pct</dt>
|
2766
|
+
|
2767
|
+
<dd>The percentage of the fill color red, green, blue and
|
2768
|
+
matte (transparency) components to blend with the image
|
2769
|
+
pixel. For example, <code>.25</code> is 25%. The matte_pct
|
2770
|
+
argument is optional.</dd>
|
2771
|
+
|
2772
|
+
<dt>fill</dt>
|
2773
|
+
|
2774
|
+
<dd>A color name or a <a href=
|
2775
|
+
"struct.html#Pixel">Pixel</a></dd>
|
2776
|
+
</dl>
|
2777
|
+
|
2778
|
+
<h4>Returns</h4>
|
2779
|
+
|
2780
|
+
<p>A new image</p>
|
2781
|
+
|
2782
|
+
<h4>Example</h4>
|
2783
|
+
|
2784
|
+
<p>This example converts a color image to a "sepia-tone-ish"
|
2785
|
+
image using the <a href="image3.html#quantize">quantize</a> and
|
2786
|
+
<code>colorize</code> methods.</p>
|
2787
|
+
|
2788
|
+
<p class="rollover"><a href=
|
2789
|
+
"javascript:popup('colorize.rb.html')"><img onmouseover=
|
2790
|
+
"this.src='ex/images/Flower_Hat.jpg'" onmouseout=
|
2791
|
+
"this.src='ex/colorize.jpg'" src="ex/colorize.jpg" alt=
|
2792
|
+
"colorize example" title=
|
2793
|
+
"Click the image to see the example script" /></a> <img src=
|
2794
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
2795
|
+
"Mouse over the example to see the original image" /></p>
|
2796
|
+
|
2797
|
+
<h4>See also</h4>
|
2798
|
+
|
2799
|
+
<p><a href="image3.html#sepiatone">sepiatone</a></p>
|
2800
|
+
|
2801
|
+
<h4>Magick API</h4>
|
2802
|
+
|
2803
|
+
<p>ColorizeImage</p>
|
2804
|
+
</div>
|
2805
|
+
|
2806
|
+
<div class="sig">
|
2807
|
+
<h3 id="colormap">colormap</h3>
|
2808
|
+
|
2809
|
+
<p><span class="arg">img</span>.colormap(<span class=
|
2810
|
+
"arg">index</span>[, <span class="arg">new_color</span>]) ->
|
2811
|
+
<em>string</em></p>
|
2812
|
+
</div>
|
2813
|
+
|
2814
|
+
<div class="desc">
|
2815
|
+
<h4>Description</h4>
|
2816
|
+
|
2817
|
+
<p>Returns the color in the color map at the specified index.
|
2818
|
+
If the <span class="arg">new_color</span> argument is
|
2819
|
+
specified, replaces the color at that index with the new
|
2820
|
+
color.</p>
|
2821
|
+
|
2822
|
+
<p>Raises IndexError if the image does not contain a color map.
|
2823
|
+
Only <a href="constants.html#ClassType">PseudoClass</a> images
|
2824
|
+
have a color map.</p>
|
2825
|
+
|
2826
|
+
<h4>Arguments</h4>
|
2827
|
+
|
2828
|
+
<dl>
|
2829
|
+
<dt>index</dt>
|
2830
|
+
|
2831
|
+
<dd>A number between 0 and the number of colors in the color
|
2832
|
+
map. If the value is out of range, <code>colormap</code>
|
2833
|
+
raises an IndexError. You can get the number of colors in the
|
2834
|
+
color map from the <a href=
|
2835
|
+
"imageattrs.html#colors">colors</a> attribute.</dd>
|
2836
|
+
|
2837
|
+
<dt>new_color</dt>
|
2838
|
+
|
2839
|
+
<dd>Optional. If specified, may be either a <a href=
|
2840
|
+
"imusage.html#color_names">color name</a> or a <a href=
|
2841
|
+
"struct.html#Pixel">pixel</a>.</dd>
|
2842
|
+
</dl>
|
2843
|
+
|
2844
|
+
<h4>Returns</h4>
|
2845
|
+
|
2846
|
+
<p>The name of the color at the specified location in the color
|
2847
|
+
map</p>
|
2848
|
+
</div>
|
2849
|
+
|
2850
|
+
<div class="sig">
|
2851
|
+
<h3 id="color_point">color_point</h3>
|
2852
|
+
|
2853
|
+
<p><span class="arg">img</span>.color_point(<span class=
|
2854
|
+
"arg">x</span>, <span class="arg">y</span>, <span class=
|
2855
|
+
"arg">fill</span>) -> <em>image</em></p>
|
2856
|
+
</div>
|
2857
|
+
|
2858
|
+
<div class="desc">
|
2859
|
+
<h4>Description</h4>Set the color of the pixel at <span class=
|
2860
|
+
"arg">x</span>,<span class="arg">y</span> to the fill color.
|
2861
|
+
This method creates a new image object. If you want to set a
|
2862
|
+
single pixel in the image without creating a new image, use
|
2863
|
+
<a href="image3.html#pixel_color">pixel_color</a> or the
|
2864
|
+
<a href="draw.html#point">Draw#point</a> method.
|
2865
|
+
|
2866
|
+
<h4>Arguments</h4>
|
2867
|
+
|
2868
|
+
<dl>
|
2869
|
+
<dt>x, y</dt>
|
2870
|
+
|
2871
|
+
<dd>The location of the pixel.</dd>
|
2872
|
+
|
2873
|
+
<dt>fill</dt>
|
2874
|
+
|
2875
|
+
<dd>The fill color, either color name or a <a href=
|
2876
|
+
"struct.html#Pixel">Pixel</a> object.</dd>
|
2877
|
+
</dl>
|
2878
|
+
|
2879
|
+
<h4>Returns</h4>
|
2880
|
+
|
2881
|
+
<p>A new image</p>
|
2882
|
+
|
2883
|
+
<h4>Example</h4>
|
2884
|
+
<pre>
|
2885
|
+
f.color_point(50,50, 'red')
|
2886
|
+
</pre>
|
2887
|
+
|
2888
|
+
<h4>See also</h4>
|
2889
|
+
|
2890
|
+
<p><a href="image3.html#pixel_color">pixel_color</a>, <a href=
|
2891
|
+
"draw.html#point">Draw#point</a></p>
|
2892
|
+
|
2893
|
+
<h4>Magick API</h4>
|
2894
|
+
|
2895
|
+
<p>GetImagePixels, SyncImagePixels</p>
|
2896
|
+
</div>
|
2897
|
+
|
2898
|
+
<div class="sig">
|
2899
|
+
<h3 id="color_reset_bang">color_reset!</h3>
|
2900
|
+
|
2901
|
+
<p><span class="arg">img</span>.color_reset!(<span class=
|
2902
|
+
"arg">fill</span>) -> <em>self</em></p>
|
2903
|
+
</div>
|
2904
|
+
|
2905
|
+
<div class="desc">
|
2906
|
+
<h4>Description</h4>
|
2907
|
+
|
2908
|
+
<p>Sets all the pixels in the image to the specified fill
|
2909
|
+
color.</p>
|
2910
|
+
|
2911
|
+
<h4>Arguments</h4>The fill color, either color name or a
|
2912
|
+
<a href="struct.html#Pixel">Pixel</a> object.
|
2913
|
+
|
2914
|
+
<h4>Returns</h4>self
|
2915
|
+
|
2916
|
+
<h4>Example</h4>
|
2917
|
+
<pre>
|
2918
|
+
f.color_reset!(red)
|
2919
|
+
</pre>
|
2920
|
+
|
2921
|
+
<h4>See also</h4>
|
2922
|
+
|
2923
|
+
<p><a href="image2.html#erase_bang">erase!</a></p>
|
2924
|
+
|
2925
|
+
<h4>Magick API</h4>SetImage
|
2926
|
+
</div>
|
2927
|
+
|
2928
|
+
<div class="sig">
|
2929
|
+
<h3 id="compare_channel">compare_channel</h3>
|
2930
|
+
|
2931
|
+
<p><span class="arg">img</span>.compare_channel(<span class=
|
2932
|
+
"arg">img</span>, <span class="arg">metric</span> [,
|
2933
|
+
<span class="arg">channel...</span>]) [ <span class=
|
2934
|
+
"arg">{ optional arguments }</span> ] ->
|
2935
|
+
[<em>image</em>, <em>float</em>]</p>
|
2936
|
+
</div>
|
2937
|
+
|
2938
|
+
<div class="desc">
|
2939
|
+
<h4>Description</h4>
|
2940
|
+
|
2941
|
+
<p>Compares <span class="arg">img</span> with the receiver.</p>
|
2942
|
+
|
2943
|
+
<h4>Arguments</h4>
|
2944
|
+
|
2945
|
+
<dl>
|
2946
|
+
<dt>image</dt>
|
2947
|
+
|
2948
|
+
<dd>Either an imagelist or an image. If an imagelist, uses
|
2949
|
+
the current image.</dd>
|
2950
|
+
|
2951
|
+
<dt>metric</dt>
|
2952
|
+
|
2953
|
+
<dd>The desired distortion metric. A <a href=
|
2954
|
+
"constants.html#MetricType">MetricType</a> value.</dd>
|
2955
|
+
|
2956
|
+
<dt>channel...</dt>
|
2957
|
+
|
2958
|
+
<dd>Zero or more <a href=
|
2959
|
+
"constants.html##ChannelType">ChannelType</a> values. All the
|
2960
|
+
specified channels contribute to the comparison and the
|
2961
|
+
distortion value. If no channels are specified, compares all
|
2962
|
+
channels.</dd>
|
2963
|
+
|
2964
|
+
<dt>optional arguments</dt>
|
2965
|
+
|
2966
|
+
<dd>
|
2967
|
+
If present, <code>compare_channel</code> yields to a block
|
2968
|
+
in which you can set optional arguments by setting
|
2969
|
+
attributes on <em>self</em>. In both cases <span class=
|
2970
|
+
"arg">color</span> may be either a <a href=
|
2971
|
+
"imusage.html#color_names">color name</a> or a <a href=
|
2972
|
+
"struct.html#Pixel">pixel</a>.
|
2973
|
+
|
2974
|
+
<dl>
|
2975
|
+
<dt>self.highlight_color = color</dt>
|
2976
|
+
|
2977
|
+
<dd>Emphasize pixel differences with this color. The
|
2978
|
+
default is partially transparent red.</dd>
|
2979
|
+
|
2980
|
+
<dt>self.lowlight_color = color</dt>
|
2981
|
+
|
2982
|
+
<dd>Demphasize pixel differences with this color. The
|
2983
|
+
default is partially transparent white.</dd>
|
2984
|
+
</dl>
|
2985
|
+
</dd>
|
2986
|
+
</dl>
|
2987
|
+
|
2988
|
+
<h4>Returns</h4>
|
2989
|
+
|
2990
|
+
<p>An array. The first element is a difference image, the
|
2991
|
+
second is a the value of the computed distortion represented as
|
2992
|
+
a <code>Float</code>.</p>
|
2993
|
+
|
2994
|
+
<h4>See also</h4>
|
2995
|
+
|
2996
|
+
<p><a href="#difference">difference</a>, <a href=
|
2997
|
+
"#spaceship"><=></a>, <a href=
|
2998
|
+
"#distortion_channel">distortion_channel</a></p>
|
2999
|
+
|
3000
|
+
<h4>Magick API</h4>
|
3001
|
+
|
3002
|
+
<p>ImageCompareChannels</p>
|
3003
|
+
|
3004
|
+
<h4>Notes</h4>
|
3005
|
+
|
3006
|
+
<p>This method was named <code>channel_compare</code> in
|
3007
|
+
earlier releases of RMagick. That name remains an alias for
|
3008
|
+
<code>compare_channel</code>.</p>
|
3009
|
+
</div>
|
3010
|
+
|
3011
|
+
<div class="sig">
|
3012
|
+
<h3 id="composite">composite</h3>
|
3013
|
+
|
3014
|
+
<p><span class="arg">dest</span>.composite(<span class=
|
3015
|
+
"arg">src</span>, <span class="arg">x</span>, <span class=
|
3016
|
+
"arg">y</span>, <span class="arg">composite_op</span>) ->
|
3017
|
+
<em>image</em><br />
|
3018
|
+
<span class="arg">dest</span>.composite(<span class=
|
3019
|
+
"arg">src</span>, <span class="arg">gravity</span>,
|
3020
|
+
<span class="arg">composite_op</span>) ->
|
3021
|
+
<em>image</em><br />
|
3022
|
+
<span class="arg">dest</span>.composite(<span class=
|
3023
|
+
"arg">src</span>, <span class="arg">gravity</span>,
|
3024
|
+
<span class="arg">x</span>, <span class="arg">y</span>,
|
3025
|
+
<span class="arg">composite_op</span>) -> <em>image</em></p>
|
3026
|
+
</div>
|
3027
|
+
|
3028
|
+
<div class="desc">
|
3029
|
+
<h4>Description</h4>Composites <span class="arg">src</span>
|
3030
|
+
onto <span class="arg">dest</span> using the specified
|
3031
|
+
composite operator.
|
3032
|
+
|
3033
|
+
<h4>Arguments</h4>
|
3034
|
+
|
3035
|
+
<p>The composite method can be called three different ways:</p>
|
3036
|
+
|
3037
|
+
<dl>
|
3038
|
+
<dt style="font-style: normal;">1. Without a gravity
|
3039
|
+
argument:</dt>
|
3040
|
+
|
3041
|
+
<dd>
|
3042
|
+
<dl>
|
3043
|
+
<dt>src</dt>
|
3044
|
+
|
3045
|
+
<dd>Either an imagelist or an image. If an imagelist,
|
3046
|
+
uses the current image.</dd>
|
3047
|
+
|
3048
|
+
<dt>x, y</dt>
|
3049
|
+
|
3050
|
+
<dd>The x- and y-offset of the composited image, measured
|
3051
|
+
from the upper-left corner of the image.</dd>
|
3052
|
+
|
3053
|
+
<dt>composite_op</dt>
|
3054
|
+
|
3055
|
+
<dd>A <a href=
|
3056
|
+
"constants.html#CompositeOperator">CompositeOperator</a>
|
3057
|
+
value.</dd>
|
3058
|
+
</dl>
|
3059
|
+
</dd>
|
3060
|
+
|
3061
|
+
<dt style="font-style: normal;">2. With a gravity
|
3062
|
+
argument, without x and y arguments:</dt>
|
3063
|
+
|
3064
|
+
<dd>
|
3065
|
+
<dl>
|
3066
|
+
<dt>src</dt>
|
3067
|
+
|
3068
|
+
<dd>Either an imagelist or an image. If an imagelist,
|
3069
|
+
uses the current image.</dd>
|
3070
|
+
|
3071
|
+
<dt>gravity</dt>
|
3072
|
+
|
3073
|
+
<dd>
|
3074
|
+
A <a href="constants.html#GravityType">GravityType</a>
|
3075
|
+
value that specifies the location of <em>img</em> on
|
3076
|
+
<em>image</em>:
|
3077
|
+
|
3078
|
+
<dl>
|
3079
|
+
<dt>NorthWestGravity</dt>
|
3080
|
+
|
3081
|
+
<dd>The composited image abuts the top and left sides
|
3082
|
+
of the image.</dd>
|
3083
|
+
|
3084
|
+
<dt>NorthGravity</dt>
|
3085
|
+
|
3086
|
+
<dd>The composited image is centered left-to-right
|
3087
|
+
and abuts the top of the image.</dd>
|
3088
|
+
|
3089
|
+
<dt>NorthEastGravity</dt>
|
3090
|
+
|
3091
|
+
<dd>The composited image abuts the top and right
|
3092
|
+
sides of the image.</dd>
|
3093
|
+
|
3094
|
+
<dt>EastGravity</dt>
|
3095
|
+
|
3096
|
+
<dd>The composited image is centered top-to-bottom
|
3097
|
+
and abuts the right side of the image.</dd>
|
3098
|
+
|
3099
|
+
<dt>SouthEastGravity</dt>
|
3100
|
+
|
3101
|
+
<dd>The composited image abuts the bottom and right
|
3102
|
+
sides of the image.</dd>
|
3103
|
+
|
3104
|
+
<dt>SouthGravity</dt>
|
3105
|
+
|
3106
|
+
<dd>The composited image is centered left-to-right
|
3107
|
+
and abuts the bottom of the image.</dd>
|
3108
|
+
|
3109
|
+
<dt>SouthWestGravity</dt>
|
3110
|
+
|
3111
|
+
<dd>The composited image abuts the bottom and left
|
3112
|
+
sides of the image.</dd>
|
3113
|
+
|
3114
|
+
<dt>WestGravity</dt>
|
3115
|
+
|
3116
|
+
<dd>The composited image is centered top-to-bottom
|
3117
|
+
and abuts the left side of the image.</dd>
|
3118
|
+
|
3119
|
+
<dt>CenterGravity</dt>
|
3120
|
+
|
3121
|
+
<dd>The composited image is centered left-to-right
|
3122
|
+
and top-to-bottom.</dd>
|
3123
|
+
</dl>
|
3124
|
+
</dd>
|
3125
|
+
|
3126
|
+
<dt>composite_op</dt>
|
3127
|
+
|
3128
|
+
<dd>A <a href=
|
3129
|
+
"constants.html#CompositeOperator">CompositeOperator</a>
|
3130
|
+
value.</dd>
|
3131
|
+
</dl>
|
3132
|
+
</dd>
|
3133
|
+
|
3134
|
+
<dt style="font-style: normal;">3. With gravity, x, and
|
3135
|
+
y arguments:</dt>
|
3136
|
+
|
3137
|
+
<dd>
|
3138
|
+
<dl>
|
3139
|
+
<dt>src</dt>
|
3140
|
+
|
3141
|
+
<dd>Either an imagelist or an image. If an imagelist,
|
3142
|
+
uses the current image.</dd>
|
3143
|
+
|
3144
|
+
<dt>gravity</dt>
|
3145
|
+
|
3146
|
+
<dd>A <a href=
|
3147
|
+
"constants.html#GravityType">GravityType</a> value.</dd>
|
3148
|
+
|
3149
|
+
<dt>x, y</dt>
|
3150
|
+
|
3151
|
+
<dd>The x- and y-offset of the composited image, measured
|
3152
|
+
relative to the <em>gravity</em> argument.</dd>
|
3153
|
+
|
3154
|
+
<dt>composite_op</dt>
|
3155
|
+
|
3156
|
+
<dd>A <a href=
|
3157
|
+
"constants.html#CompositeOperator">CompositeOperator</a>
|
3158
|
+
value.</dd>
|
3159
|
+
</dl>
|
3160
|
+
</dd>
|
3161
|
+
</dl>
|
3162
|
+
|
3163
|
+
<h4>Returns</h4>
|
3164
|
+
|
3165
|
+
<p>A new image</p>
|
3166
|
+
|
3167
|
+
<h4>Example</h4>
|
3168
|
+
|
3169
|
+
<p>This example shows the effect of some of the composite
|
3170
|
+
operators.</p>
|
3171
|
+
|
3172
|
+
<p><a href="javascript:popup('composite.rb.html')"><img src=
|
3173
|
+
"ex/composite.gif" alt="composite example" title=
|
3174
|
+
"Click the image to see the example script" /></a></p>
|
3175
|
+
|
3176
|
+
<h4>See also</h4>
|
3177
|
+
|
3178
|
+
<p><a href="#composite_bang">composite!</a>, <a href=
|
3179
|
+
"#dissolve">dissolve</a>, <a href=
|
3180
|
+
"image3.html#watermark">watermark</a></p>
|
3181
|
+
|
3182
|
+
<h4>Magick API</h4>
|
3183
|
+
|
3184
|
+
<p>CompositeImage</p>
|
3185
|
+
</div>
|
3186
|
+
|
3187
|
+
<div class="sig">
|
3188
|
+
<h3 id="composite_bang">composite!</h3>
|
3189
|
+
|
3190
|
+
<p><span class="arg">dest</span>.composite!(<span class=
|
3191
|
+
"arg">src</span>, <span class="arg">x</span>, <span class=
|
3192
|
+
"arg">y</span>, <span class="arg">composite_op</span>) ->
|
3193
|
+
<em>self</em><br />
|
3194
|
+
<span class="arg">dest</span>.composite!(<span class=
|
3195
|
+
"arg">src</span>, <span class="arg">gravity</span>,
|
3196
|
+
<span class="arg">composite_op</span>) ->
|
3197
|
+
<em>self</em><br />
|
3198
|
+
<span class="arg">dest</span>.composite!(<span class=
|
3199
|
+
"arg">src</span>, <span class="arg">gravity</span>,
|
3200
|
+
<span class="arg">x</span>, <span class="arg">y</span>,
|
3201
|
+
<span class="arg">composite_op</span>) -> <em>self</em></p>
|
3202
|
+
</div>
|
3203
|
+
|
3204
|
+
<div class="desc">
|
3205
|
+
<h4>Description</h4>
|
3206
|
+
|
3207
|
+
<p>In-place form of <a href="#composite">composite</a>.</p>
|
3208
|
+
|
3209
|
+
<h4>Returns</h4>
|
3210
|
+
|
3211
|
+
<p>self</p>
|
3212
|
+
</div>
|
3213
|
+
|
3214
|
+
<div class="sig">
|
3215
|
+
<h3 id="composite_affine">composite_affine</h3>
|
3216
|
+
|
3217
|
+
<p><span class="arg">dest</span>.composite_affine(<span class=
|
3218
|
+
"arg">src</span>, <span class="arg">affine</span>) ->
|
3219
|
+
<em>image</em></p>
|
3220
|
+
</div>
|
3221
|
+
|
3222
|
+
<div class="desc">
|
3223
|
+
<h4>Description</h4>Composite <span class="arg">src</span> over
|
3224
|
+
<span class="arg">dest</span> as dictated by the <span class=
|
3225
|
+
"arg">affine</span> argument.
|
3226
|
+
|
3227
|
+
<h4>Arguments</h4>
|
3228
|
+
|
3229
|
+
<dl>
|
3230
|
+
<dt>img</dt>
|
3231
|
+
|
3232
|
+
<dd>An image or imagelist</dd>
|
3233
|
+
|
3234
|
+
<dt>affine</dt>
|
3235
|
+
|
3236
|
+
<dd>An <code>AffineMatrix</code></dd>
|
3237
|
+
</dl>
|
3238
|
+
|
3239
|
+
<h4>Returns</h4>
|
3240
|
+
|
3241
|
+
<p>A new image</p>
|
3242
|
+
|
3243
|
+
<h4>See also</h4>
|
3244
|
+
|
3245
|
+
<p><a href="#composite">composite</a>, <a href=
|
3246
|
+
"#affine_transform">affine_transform</a></p>
|
3247
|
+
|
3248
|
+
<h4>Magick API</h4>
|
3249
|
+
|
3250
|
+
<p>DrawAffineImage</p>
|
3251
|
+
</div>
|
3252
|
+
|
3253
|
+
<div class="sig">
|
3254
|
+
<h3 id="composite_mathematics">composite_mathematics</h3>
|
3255
|
+
|
3256
|
+
<p><span class=
|
3257
|
+
"arg">dest</span>.composite_mathematics(<span class=
|
3258
|
+
"arg">src</span>, <span class="arg">a</span>, <span class=
|
3259
|
+
"arg">b</span>, <span class="arg">c</span>, <span class=
|
3260
|
+
"arg">d</span>, <span class="arg">gravity</span>) ->
|
3261
|
+
<em>image</em><br />
|
3262
|
+
<span class=
|
3263
|
+
"arg">dest</span>.composite_mathematics(<span class="arg">src</span>,
|
3264
|
+
<span class="arg">a</span>, <span class="arg">b</span>,
|
3265
|
+
<span class="arg">c</span>, <span class="arg">d</span>,
|
3266
|
+
<span class="arg">x</span>, <span class="arg">y</span>) ->
|
3267
|
+
<em>image</em><br />
|
3268
|
+
<span class=
|
3269
|
+
"arg">dest</span>.composite_mathematics(<span class="arg">src</span>,
|
3270
|
+
<span class="arg">a</span>, <span class="arg">b</span>,
|
3271
|
+
<span class="arg">c</span>, <span class="arg">d</span>,
|
3272
|
+
<span class="arg">gravity</span>, <span class="arg">x</span>,
|
3273
|
+
<span class="arg">y</span>) -> <em>image</em></p>
|
3274
|
+
</div>
|
3275
|
+
|
3276
|
+
<div class="desc">
|
3277
|
+
<h4>Description</h4>
|
3278
|
+
|
3279
|
+
<p>Merge the source and destination images according to the
|
3280
|
+
formula
|
3281
|
+
<em>a*Sc*Dc + b*Sc + c*Dc + d</em>
|
3282
|
+
where Sc is the source pixel and Dc is the destination
|
3283
|
+
pixel.</p>
|
3284
|
+
|
3285
|
+
<p>Equivalent to the <code>-compose Mathematics -set
|
3286
|
+
option:compose:args a,b,c,d</code> options to ImagMagick's
|
3287
|
+
<code>convert</code> command. See <a href=
|
3288
|
+
"http://www.imagemagick.org/Usage/compose/#mathematics">Examples
|
3289
|
+
of ImageMagick Usage</a>.</p>
|
3290
|
+
|
3291
|
+
<h4>Arguments</h4>
|
3292
|
+
|
3293
|
+
<dl>
|
3294
|
+
<dt>src</dt>
|
3295
|
+
|
3296
|
+
<dd>Either an imagelist or an image. If an imagelist, uses
|
3297
|
+
the current image.</dd>
|
3298
|
+
|
3299
|
+
<dt>a, b, c, d</dt>
|
3300
|
+
|
3301
|
+
<dd>See the description.</dd>
|
3302
|
+
|
3303
|
+
<dt>gravity</dt>
|
3304
|
+
|
3305
|
+
<dd>A <a href="constants.html#GravityType">GravityType</a>
|
3306
|
+
value. If omitted, the default gravity is
|
3307
|
+
NorthWestGravity.</dd>
|
3308
|
+
|
3309
|
+
<dt>x, y</dt>
|
3310
|
+
|
3311
|
+
<dd>The x- and y-offset of the composited image, measured
|
3312
|
+
relative to the <em>gravity</em> argument. If omitted, the
|
3313
|
+
default value is 0.0.</dd>
|
3314
|
+
</dl>
|
3315
|
+
|
3316
|
+
<h4>Returns</h4>
|
3317
|
+
|
3318
|
+
<p>A new image</p>
|
3319
|
+
|
3320
|
+
<h4>See also</h4>
|
3321
|
+
|
3322
|
+
<p><a href="#composite">composite</a></p>
|
3323
|
+
|
3324
|
+
<h4>Magick API</h4>
|
3325
|
+
|
3326
|
+
<p>CompositeImage</p>
|
3327
|
+
</div>
|
3328
|
+
|
3329
|
+
<div class="sig">
|
3330
|
+
<h3 id="composite_tiled">composite_tiled</h3>
|
3331
|
+
|
3332
|
+
<p><span class="arg">img</span>.composite_tiled(<span class=
|
3333
|
+
"arg">src</span>, <span class="arg">composite_op</span> =
|
3334
|
+
Magick::OverCompositeOp) -> <em>image</em></p>
|
3335
|
+
</div>
|
3336
|
+
|
3337
|
+
<div class="desc">
|
3338
|
+
<h4>Description</h4>
|
3339
|
+
|
3340
|
+
<p>Composites multiple copies of the source image across and
|
3341
|
+
down the image, producing the same results as ImageMagick's
|
3342
|
+
composite command with the -tile option.</p>
|
3343
|
+
|
3344
|
+
<h4>Arguments</h4>
|
3345
|
+
|
3346
|
+
<dl>
|
3347
|
+
<dt>src</dt>
|
3348
|
+
|
3349
|
+
<dd>The source image</dd>
|
3350
|
+
|
3351
|
+
<dt>composite_op</dt>
|
3352
|
+
|
3353
|
+
<dd>A <a href=
|
3354
|
+
"constants.html#CompositeOperator">CompositeOperator</a>
|
3355
|
+
value</dd>
|
3356
|
+
</dl>
|
3357
|
+
|
3358
|
+
<h4>Returns</h4>
|
3359
|
+
|
3360
|
+
<p>A new image</p>
|
3361
|
+
|
3362
|
+
<h4>See also</h4>
|
3363
|
+
|
3364
|
+
<p><a href="#composite">composite</a>, <a href=
|
3365
|
+
"#composite_tiled_bang">composite_tiled!</a></p>
|
3366
|
+
|
3367
|
+
<h4>Magick API</h4>
|
3368
|
+
|
3369
|
+
<p>CompositeImage</p>
|
3370
|
+
</div>
|
3371
|
+
|
3372
|
+
<div class="sig">
|
3373
|
+
<h3 id="composite_tiled_bang">composite_tiled!</h3>
|
3374
|
+
|
3375
|
+
<p><span class="arg">img</span>.composite_tiled!(<span class=
|
3376
|
+
"arg">src</span>, <span class="arg">composite_op</span> =
|
3377
|
+
Magick::OverCompositeOp) -> <em>self</em></p>
|
3378
|
+
</div>
|
3379
|
+
|
3380
|
+
<div class="desc">
|
3381
|
+
<h4>Description</h4>
|
3382
|
+
|
3383
|
+
<p>In-place form of <a href=
|
3384
|
+
"#composite_tiled">composite_tiled</a>.</p>
|
3385
|
+
|
3386
|
+
<h4>Example</h4>
|
3387
|
+
|
3388
|
+
<p class="rollover"><a href=
|
3389
|
+
"javascript:popup('composite_tiled.rb.html')"><img onmouseover=
|
3390
|
+
"this.src='ex/images/Flower_Hat.jpg'" onmouseout=
|
3391
|
+
"this.src='ex/composite_tiled.jpg'" src=
|
3392
|
+
"ex/composite_tiled.jpg" alt="composite_tiled example" title=
|
3393
|
+
"Click the image to see the example script" /></a> <img src=
|
3394
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
3395
|
+
"Mouse over the example to see the original image" /></p>
|
3396
|
+
|
3397
|
+
<h4>Returns</h4>
|
3398
|
+
|
3399
|
+
<p>self</p>
|
3400
|
+
|
3401
|
+
<h4>See also</h4>
|
3402
|
+
|
3403
|
+
<p><a href="#composite_bang">composite!</a>, <a href=
|
3404
|
+
"#composite_tiled">composite_tiled</a></p>
|
3405
|
+
|
3406
|
+
<h4>Magick API</h4>
|
3407
|
+
|
3408
|
+
<p>CompositeImage</p>
|
3409
|
+
</div>
|
3410
|
+
|
3411
|
+
<div class="sig">
|
3412
|
+
<h3 id="compress_colormap">compress_colormap</h3>
|
3413
|
+
|
3414
|
+
<p><span class="arg">img</span>.compress_colormap! ->
|
3415
|
+
<em>self</em></p>
|
3416
|
+
</div>
|
3417
|
+
|
3418
|
+
<div class="desc">
|
3419
|
+
<h4>Description</h4>
|
3420
|
+
|
3421
|
+
<p>Removes duplicate or unused entries in the colormap. Only
|
3422
|
+
<a href="constants.html#ClassType">PseudoClass</a> images have
|
3423
|
+
a colormap. If the image is <code>DirectClass</code> then
|
3424
|
+
<code>compress_colormap!</code> converts it to
|
3425
|
+
<code>PseudoClass</code>.</p>
|
3426
|
+
|
3427
|
+
<h4>Returns</h4>self
|
3428
|
+
|
3429
|
+
<h4>Example</h4>
|
3430
|
+
<pre>
|
3431
|
+
f = Image.read('cbezier1.gif').first »
|
3432
|
+
cbezier1.gif GIF 500x350+0+0 PseudoClass 128c 8-bit 177503b
|
3433
|
+
f.colors » 128
|
3434
|
+
f.compress_colormap! »
|
3435
|
+
cbezier1.gif GIF 500x350+0+0 PseudoClass 108c 8-bit 177503b
|
3436
|
+
f.colors » 108
|
3437
|
+
</pre>
|
3438
|
+
|
3439
|
+
<h4>Magick API</h4>
|
3440
|
+
|
3441
|
+
<p>CompressColormap</p>
|
3442
|
+
</div>
|
3443
|
+
|
3444
|
+
<div class="sig">
|
3445
|
+
<h3 id="contrast">contrast</h3>
|
3446
|
+
|
3447
|
+
<p><span class="arg">img</span>.contrast(<span class=
|
3448
|
+
"arg">sharpen</span>=<code>false</code>) ->
|
3449
|
+
<em>image</em></p>
|
3450
|
+
</div>
|
3451
|
+
|
3452
|
+
<div class="desc">
|
3453
|
+
<h4>Description</h4>
|
3454
|
+
|
3455
|
+
<p class="imquote">Enhances or reduces the intensity
|
3456
|
+
differences between the lighter and darker elements of the
|
3457
|
+
image.</p>
|
3458
|
+
|
3459
|
+
<h4>Arguments</h4>If <span class="arg">sharpen</span> is
|
3460
|
+
<code>true</code>, the contrast is increased, otherwise it is
|
3461
|
+
reduced.
|
3462
|
+
|
3463
|
+
<h4>Returns</h4>
|
3464
|
+
|
3465
|
+
<p>A new image</p>
|
3466
|
+
|
3467
|
+
<h4>Example</h4>
|
3468
|
+
|
3469
|
+
<p>In this example the contrast is <em>reduced</em> in each
|
3470
|
+
successive image.</p><a href=
|
3471
|
+
"javascript:popup('contrast.rb.html')"><img src=
|
3472
|
+
"ex/contrast.jpg" alt="contrast example" title=
|
3473
|
+
"Click the image to see the example script" /></a>
|
3474
|
+
|
3475
|
+
<h4>See also</h4>
|
3476
|
+
|
3477
|
+
<p><a href=
|
3478
|
+
"#contrast_stretch_channel">contrast_stretch_channel</a>,
|
3479
|
+
<a href=
|
3480
|
+
"image3.html#sigmoidal_contrast_channel">sigmoidal_contrast_channel</a></p>
|
3481
|
+
|
3482
|
+
<h4>Magick API</h4>
|
3483
|
+
|
3484
|
+
<p>ContrastImage</p>
|
3485
|
+
</div>
|
3486
|
+
|
3487
|
+
<div class="sig">
|
3488
|
+
<h3 id="contrast_stretch_channel">contrast_stretch_channel</h3>
|
3489
|
+
|
3490
|
+
<p><span class=
|
3491
|
+
"arg">img</span>.contrast_stretch_channel(<span class=
|
3492
|
+
"arg">black_point</span> [, <span class=
|
3493
|
+
"arg">white_point</span>] [, <span class=
|
3494
|
+
"arg">channel</span>...]) -> <span class=
|
3495
|
+
"arg">image</span></p>
|
3496
|
+
</div>
|
3497
|
+
|
3498
|
+
<div class="desc">
|
3499
|
+
<h4>Description</h4>
|
3500
|
+
|
3501
|
+
<p>This method <span class="imquote">is a simple image
|
3502
|
+
enhancement technique that attempts to improve the contrast in
|
3503
|
+
an image by `stretching' the range of intensity values it
|
3504
|
+
contains to span a desired range of values. It differs from the
|
3505
|
+
more sophisticated histogram equalization in that it can only
|
3506
|
+
apply a linear scaling function to the image pixel values. As a
|
3507
|
+
result the `enhancement' is less harsh.</span></p>
|
3508
|
+
|
3509
|
+
<h4>Arguments</h4>
|
3510
|
+
|
3511
|
+
<dl>
|
3512
|
+
<dt>black_point</dt>
|
3513
|
+
|
3514
|
+
<dd>black out at most this many pixels. Specify an absolute
|
3515
|
+
number of pixels as a numeric value, or a percentage as a
|
3516
|
+
string in the form 'NN%'.</dd>
|
3517
|
+
|
3518
|
+
<dt>white_point</dt>
|
3519
|
+
|
3520
|
+
<dd>burn at most this many pixels. Specify an absolute number
|
3521
|
+
of pixels as a numeric value, or a percentage as a string in
|
3522
|
+
the form 'NN%'. This argument is optional. If not specified
|
3523
|
+
the default is <code>all pixels - black_point
|
3524
|
+
pixels</code>.</dd>
|
3525
|
+
|
3526
|
+
<dt>channel...</dt>
|
3527
|
+
|
3528
|
+
<dd>0 or more <a href=
|
3529
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
3530
|
+
channels are specified all channels are included.</dd>
|
3531
|
+
</dl>
|
3532
|
+
|
3533
|
+
<h4>Returns</h4>
|
3534
|
+
|
3535
|
+
<p>A new image</p>
|
3536
|
+
|
3537
|
+
<h4>See also</h4>
|
3538
|
+
|
3539
|
+
<p><a href="#contrast">contrast</a>, <a href=
|
3540
|
+
"image2.html#equalize">equalize</a></p>
|
3541
|
+
|
3542
|
+
<h4>Magick API</h4>
|
3543
|
+
|
3544
|
+
<p>ContrastStretchImage</p>
|
3545
|
+
</div>
|
3546
|
+
|
3547
|
+
<div class="sig">
|
3548
|
+
<h3 id="convolve">convolve</h3>
|
3549
|
+
|
3550
|
+
<p><span class="arg">img</span>.convolve(<span class=
|
3551
|
+
"arg">order</span>, <span class="arg">kernel</span>) ->
|
3552
|
+
<em>image</em></p>
|
3553
|
+
</div>
|
3554
|
+
|
3555
|
+
<div class="desc">
|
3556
|
+
<h4>Description</h4>
|
3557
|
+
|
3558
|
+
<p class="imquote">Applies a custom convolution kernel to the
|
3559
|
+
image.</p>
|
3560
|
+
|
3561
|
+
<h4>Arguments</h4>
|
3562
|
+
|
3563
|
+
<dl>
|
3564
|
+
<dt>order</dt>
|
3565
|
+
|
3566
|
+
<dd>The number of columns and rows in the kernel.</dd>
|
3567
|
+
|
3568
|
+
<dt>kernel</dt>
|
3569
|
+
|
3570
|
+
<dd>An <span class="arg">order</span>*<span class=
|
3571
|
+
"arg">order</span> matrix of <code>Float</code> values.</dd>
|
3572
|
+
</dl>
|
3573
|
+
|
3574
|
+
<h4>Returns</h4>
|
3575
|
+
|
3576
|
+
<p>A new image</p>
|
3577
|
+
|
3578
|
+
<h4>See also</h4>
|
3579
|
+
|
3580
|
+
<p><a href="#convolve_channel">convolve_channel</a>. The
|
3581
|
+
<a href="image2.html#edge">edge</a>, <a href=
|
3582
|
+
"image2.html#emboss">emboss</a>, <a href=
|
3583
|
+
"image2.html#gaussian_blur">gaussian_blur</a>, <a href=
|
3584
|
+
"image2.html#motion_blur">motion_blur</a> and <a href=
|
3585
|
+
"image2.html#sharpen">sharpen</a> methods use convolution to do
|
3586
|
+
their work.</p>
|
3587
|
+
|
3588
|
+
<h4>Magick API</h4>
|
3589
|
+
|
3590
|
+
<p>ConvolveImage</p>
|
3591
|
+
|
3592
|
+
<h4>Note</h4>
|
3593
|
+
|
3594
|
+
<p>See <a href=
|
3595
|
+
"http://www.dai.ed.ac.uk/HIPR2/convolve.htm">Convolution</a> in
|
3596
|
+
the <a href=
|
3597
|
+
"http://www.dai.ed.ac.uk/HIPR2/copyrght.htm"><cite>Hypermedia
|
3598
|
+
Image Processing Reference</cite></a></p>
|
3599
|
+
</div>
|
3600
|
+
|
3601
|
+
<div class="sig">
|
3602
|
+
<h3 id="convolve_channel">convolve_channel</h3>
|
3603
|
+
|
3604
|
+
<p><span class="arg">img</span>.convolve_channel(<span class=
|
3605
|
+
"arg">order</span>, <span class="arg">kernel</span> [,
|
3606
|
+
<span class="arg">channel</span>...]) -> <em>image</em></p>
|
3607
|
+
</div>
|
3608
|
+
|
3609
|
+
<div class="desc">
|
3610
|
+
<h4>Description</h4>
|
3611
|
+
|
3612
|
+
<p>Applies a custom convolution kernel to the specified channel
|
3613
|
+
or channels in the image.</p>
|
3614
|
+
|
3615
|
+
<h4>Arguments</h4>
|
3616
|
+
|
3617
|
+
<dl>
|
3618
|
+
<dt>order</dt>
|
3619
|
+
|
3620
|
+
<dd>The number of columns and rows in the kernel.</dd>
|
3621
|
+
|
3622
|
+
<dt>kernel</dt>
|
3623
|
+
|
3624
|
+
<dd>An <span class="arg">order</span>*<span class=
|
3625
|
+
"arg">order</span> matrix of <code>Float</code> values.</dd>
|
3626
|
+
|
3627
|
+
<dt>channel...</dt>
|
3628
|
+
|
3629
|
+
<dd>0 or more <a href=
|
3630
|
+
"constants.html#ChannelType">ChannelType</a> arguments. If no
|
3631
|
+
channels are specified the effect is the same as calling
|
3632
|
+
<a href="#convolve">convolve</a>.</dd>
|
3633
|
+
</dl>
|
3634
|
+
|
3635
|
+
<h4>Returns</h4>
|
3636
|
+
|
3637
|
+
<p>A new image</p>
|
3638
|
+
|
3639
|
+
<h4>Magick API</h4>
|
3640
|
+
|
3641
|
+
<p>ConvolveImageChannel</p>
|
3642
|
+
|
3643
|
+
<h4>See also</h4>
|
3644
|
+
|
3645
|
+
<p><a href="#convolve">convolve</a></p>
|
3646
|
+
</div>
|
3647
|
+
|
3648
|
+
<div class="sig">
|
3649
|
+
<h3 id="copy">copy</h3>
|
3650
|
+
|
3651
|
+
<p><span class="arg">img</span>.copy ->
|
3652
|
+
<em>other_image</em></p>
|
3653
|
+
</div>
|
3654
|
+
|
3655
|
+
<div class="desc">
|
3656
|
+
<h4>Description</h4>Returns a copy of the image. The tainted
|
3657
|
+
state of the original is propagated to the copy.
|
3658
|
+
|
3659
|
+
<h4>Example</h4>
|
3660
|
+
<pre>
|
3661
|
+
f2 = f.copy
|
3662
|
+
</pre>
|
3663
|
+
|
3664
|
+
<h4>See also</h4>
|
3665
|
+
|
3666
|
+
<p><a href="#clone">clone</a>, <a href="#dup">dup</a>, <a href=
|
3667
|
+
"ilist.html#copy">ImageList#copy</a></p>
|
3668
|
+
|
3669
|
+
<h4>Magick API</h4>
|
3670
|
+
|
3671
|
+
<p>CloneImage</p>
|
3672
|
+
</div>
|
3673
|
+
|
3674
|
+
<div class="sig">
|
3675
|
+
<h3 id="crop">crop</h3>
|
3676
|
+
|
3677
|
+
<p><span class="arg">img</span>.crop(<span class=
|
3678
|
+
"arg">x</span>, <span class="arg">y</span>, <span class=
|
3679
|
+
"arg">width</span>, <span class="arg">height</span>) ->
|
3680
|
+
<em>image</em><br />
|
3681
|
+
<span class="arg">img</span>.crop(<span class=
|
3682
|
+
"arg">gravity</span>, <span class="arg">x</span>, <span class=
|
3683
|
+
"arg">y</span>, <span class="arg">width</span>, <span class=
|
3684
|
+
"arg">height</span>) -> <em>image</em><br />
|
3685
|
+
<span class="arg">img</span>.crop(<span class=
|
3686
|
+
"arg">gravity</span>, <span class="arg">width</span>,
|
3687
|
+
<span class="arg">height</span>) -> <em>image</em></p>
|
3688
|
+
</div>
|
3689
|
+
|
3690
|
+
<div class="desc">
|
3691
|
+
<h4>Description</h4>
|
3692
|
+
|
3693
|
+
<p>Extracts the specified rectangle from the image.</p>
|
3694
|
+
|
3695
|
+
<h4>Arguments</h4>
|
3696
|
+
|
3697
|
+
<p>The crop method can be called three different ways:</p>
|
3698
|
+
|
3699
|
+
<dl>
|
3700
|
+
<dt style="font-style: normal;">1. Without a
|
3701
|
+
<em>gravity</em> argument:</dt>
|
3702
|
+
|
3703
|
+
<dd>
|
3704
|
+
<dl>
|
3705
|
+
<dt>x, y</dt>
|
3706
|
+
|
3707
|
+
<dd>The <em>x-</em> and <em>y-</em>offset of the
|
3708
|
+
rectangle relative to the upper-left corner of the
|
3709
|
+
image</dd>
|
3710
|
+
|
3711
|
+
<dt>width, height</dt>
|
3712
|
+
|
3713
|
+
<dd>The width and height of the rectangle.</dd>
|
3714
|
+
</dl>
|
3715
|
+
</dd>
|
3716
|
+
|
3717
|
+
<dt style="font-style: normal;">2. With a
|
3718
|
+
<em>gravity</em> argument, but without <em>x</em> and
|
3719
|
+
<em>y</em> arguments:</dt>
|
3720
|
+
|
3721
|
+
<dd>
|
3722
|
+
<dl>
|
3723
|
+
<dt>gravity</dt>
|
3724
|
+
|
3725
|
+
<dd>
|
3726
|
+
A <a href="constants.html#GravityType">GravityType</a>
|
3727
|
+
value specifying the position of the rectangle.
|
3728
|
+
|
3729
|
+
<dl>
|
3730
|
+
<dt>NorthWestGravity</dt>
|
3731
|
+
|
3732
|
+
<dd>The rectangle abuts the top and left sides of the
|
3733
|
+
image.</dd>
|
3734
|
+
|
3735
|
+
<dt>NorthGravity</dt>
|
3736
|
+
|
3737
|
+
<dd>The rectangle is centered left-to-right and abuts
|
3738
|
+
the top of the image.</dd>
|
3739
|
+
|
3740
|
+
<dt>NorthEastGravity</dt>
|
3741
|
+
|
3742
|
+
<dd>The rectangle abuts the top and right sides of
|
3743
|
+
the image.</dd>
|
3744
|
+
|
3745
|
+
<dt>EastGravity</dt>
|
3746
|
+
|
3747
|
+
<dd>The rectangle is centered top-to-bottom and abuts
|
3748
|
+
the right side of the image.</dd>
|
3749
|
+
|
3750
|
+
<dt>SouthEastGravity</dt>
|
3751
|
+
|
3752
|
+
<dd>The rectangle abuts the bottom and right sides of
|
3753
|
+
the image.</dd>
|
3754
|
+
|
3755
|
+
<dt>SouthGravity</dt>
|
3756
|
+
|
3757
|
+
<dd>The rectangle is centered left-to-right and abuts
|
3758
|
+
the bottom of the image.</dd>
|
3759
|
+
|
3760
|
+
<dt>SouthWestGravity</dt>
|
3761
|
+
|
3762
|
+
<dd>The rectangle abuts the bottom and left sides of
|
3763
|
+
the image.</dd>
|
3764
|
+
|
3765
|
+
<dt>WestGravity</dt>
|
3766
|
+
|
3767
|
+
<dd>The rectangle is centered top-to-bottom and abuts
|
3768
|
+
the left side of the image.</dd>
|
3769
|
+
|
3770
|
+
<dt>CenterGravity</dt>
|
3771
|
+
|
3772
|
+
<dd>The rectangle is centered left-to-right and
|
3773
|
+
top-to-bottom.</dd>
|
3774
|
+
</dl>
|
3775
|
+
</dd>
|
3776
|
+
|
3777
|
+
<dt>width, height</dt>
|
3778
|
+
|
3779
|
+
<dd>The width and height of the rectangle.</dd>
|
3780
|
+
</dl>
|
3781
|
+
</dd>
|
3782
|
+
|
3783
|
+
<dt style="font-style: normal;">3. With
|
3784
|
+
<em>gravity</em>, <em>x</em>, and <em>y</em> arguments:</dt>
|
3785
|
+
|
3786
|
+
<dd>
|
3787
|
+
<dl>
|
3788
|
+
<dt>gravity</dt>
|
3789
|
+
|
3790
|
+
<dd>A <a href=
|
3791
|
+
"constants.html#GravityType">GravityType</a> value. If
|
3792
|
+
the argument is NorthEastGravity, EastGravity, or
|
3793
|
+
SouthEastGravity, the <em>x-</em>offset is measured from
|
3794
|
+
the right side of the image. If the argument is
|
3795
|
+
SouthEastGravity, SouthGravity, or SouthWestGravity, the
|
3796
|
+
<em>y-</em>offset is measured from the bottom of the
|
3797
|
+
image. All other values are ignored and the <em>x-</em>
|
3798
|
+
and <em>y-</em>offsets are measured from the upper-left
|
3799
|
+
corner of the image.</dd>
|
3800
|
+
|
3801
|
+
<dt>x, y</dt>
|
3802
|
+
|
3803
|
+
<dd>The <em>x-</em> and <em>y-</em>offset of the
|
3804
|
+
rectangle from the sides specified by the
|
3805
|
+
<em>gravity</em> argument.</dd>
|
3806
|
+
|
3807
|
+
<dt>width, height</dt>
|
3808
|
+
|
3809
|
+
<dd>The width and height of the rectangle.</dd>
|
3810
|
+
</dl>
|
3811
|
+
</dd>
|
3812
|
+
</dl>
|
3813
|
+
|
3814
|
+
<h4>Notes</h4>The <code>crop</code> method retains the offset
|
3815
|
+
information in the cropped image. This may cause the image to
|
3816
|
+
appear to be surrounded by blank or black space when viewed
|
3817
|
+
with an external viewer. This only occurs when the image is
|
3818
|
+
saved in a format (such as GIF) that saves offset information.
|
3819
|
+
To reset the offset data, add <code>true</code> as the last
|
3820
|
+
argument to <code>crop</code>. For example,
|
3821
|
+
<pre>
|
3822
|
+
cropped = img.crop(x, y, width, height, true)
|
3823
|
+
</pre>
|
3824
|
+
|
3825
|
+
<p>You can add <code>true</code> as the last argument with any
|
3826
|
+
of the three argument list formats described above.</p>
|
3827
|
+
|
3828
|
+
<h4>Returns</h4>
|
3829
|
+
|
3830
|
+
<p>A new image</p>
|
3831
|
+
|
3832
|
+
<h4>Example</h4>
|
3833
|
+
|
3834
|
+
<p>The crop rectangle is highlighted in the "before" image.</p>
|
3835
|
+
|
3836
|
+
<p class="rollover"><a href=
|
3837
|
+
"javascript:popup('crop.rb.html')"><img onmouseover=
|
3838
|
+
"this.src='ex/crop_before.png'" onmouseout=
|
3839
|
+
"this.src='ex/crop_after.png'" src="ex/crop_after.png" alt=
|
3840
|
+
"crop example" title=
|
3841
|
+
"Click the image to see the example script" /></a><img src=
|
3842
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
3843
|
+
"Mouse over the example to see the original image" /></p>
|
3844
|
+
|
3845
|
+
<h4>Example 2</h4>
|
3846
|
+
|
3847
|
+
<p><a href=
|
3848
|
+
"javascript:popup('crop_with_gravity.rb.html')">crop_with_gravity.rb</a></p>
|
3849
|
+
|
3850
|
+
<h4>See also</h4>
|
3851
|
+
|
3852
|
+
<p><a href="#crop_bang">crop!</a>, <a href="#chop">chop</a>,
|
3853
|
+
<a href="image2.html#excerpt">excerpt</a></p>
|
3854
|
+
|
3855
|
+
<h4>Magick API</h4>
|
3856
|
+
|
3857
|
+
<p>CropImage</p>
|
3858
|
+
</div>
|
3859
|
+
|
3860
|
+
<div class="sig">
|
3861
|
+
<h3 id="crop_bang">crop!</h3>
|
3862
|
+
|
3863
|
+
<p><span class="arg">img</span>.crop!(<span class=
|
3864
|
+
"arg">x</span>, <span class="arg">y</span>, <span class=
|
3865
|
+
"arg">width</span>, <span class="arg">height</span>) ->
|
3866
|
+
<em>self</em><br />
|
3867
|
+
<span class="arg">img</span>.crop!(<span class=
|
3868
|
+
"arg">gravity</span>, <span class="arg">x</span>, <span class=
|
3869
|
+
"arg">y</span>, <span class="arg">width</span>, <span class=
|
3870
|
+
"arg">height</span>) -> <em>self</em><br />
|
3871
|
+
<span class="arg">img</span>.crop!(<span class=
|
3872
|
+
"arg">gravity</span>, <span class="arg">width</span>,
|
3873
|
+
<span class="arg">height</span>) -> <em>self</em></p>
|
3874
|
+
</div>
|
3875
|
+
|
3876
|
+
<div class="desc">
|
3877
|
+
<h4>Description</h4>The in-place form of <a href=
|
3878
|
+
"#crop">crop</a>.
|
3879
|
+
|
3880
|
+
<h4>Returns</h4>
|
3881
|
+
|
3882
|
+
<p>self</p>
|
3883
|
+
</div>
|
3884
|
+
|
3885
|
+
<div class="sig">
|
3886
|
+
<h3 id="crop_resized">crop_resized</h3>
|
3887
|
+
|
3888
|
+
<p><span class="arg">img</span>.crop_resized(<span class=
|
3889
|
+
"arg">width</span>, <span class="arg">height</span>,
|
3890
|
+
gravity=CenterGravity) -> <em>image</em></p>
|
3891
|
+
</div>
|
3892
|
+
|
3893
|
+
<div class="desc">
|
3894
|
+
<h4>Description</h4>
|
3895
|
+
|
3896
|
+
<p>An alias for <a href=
|
3897
|
+
"image3.html#resize_to_fill">resize_to_fill</a>.</p>
|
3898
|
+
</div>
|
3899
|
+
|
3900
|
+
<div class="sig">
|
3901
|
+
<h3 id="cycle_colormap">cycle_colormap</h3>
|
3902
|
+
|
3903
|
+
<p><span class="arg">img</span>.cycle_colormap(<span class=
|
3904
|
+
"arg">amount</span>) -> <em>image</em></p>
|
3905
|
+
</div>
|
3906
|
+
|
3907
|
+
<div class="desc">
|
3908
|
+
<h4>Description</h4>
|
3909
|
+
|
3910
|
+
<p class="imquote">Displaces the colormap by a given number of
|
3911
|
+
positions. If you cycle the colormap a number of times you can
|
3912
|
+
produce a psychedelic effect.</p>
|
3913
|
+
|
3914
|
+
<p>The returned image is always a <code>PseudoClass</code>
|
3915
|
+
image, regardless of the type of the original image.</p>
|
3916
|
+
|
3917
|
+
<h4>Arguments</h4>
|
3918
|
+
|
3919
|
+
<p>The number of positions to cycle.</p>
|
3920
|
+
|
3921
|
+
<h4>Returns</h4>
|
3922
|
+
|
3923
|
+
<p>A new image</p>
|
3924
|
+
|
3925
|
+
<h4>Example</h4>
|
3926
|
+
|
3927
|
+
<p>Mouse over the image to see an animation made by cycling the
|
3928
|
+
colormap between each copy.</p>
|
3929
|
+
|
3930
|
+
<p class="rollover"><a href=
|
3931
|
+
"javascript:popup('cycle_colormap.rb.html')"><img onmouseover=
|
3932
|
+
"this.src='ex/cycle_colormap.gif'" onmouseout=
|
3933
|
+
"this.src='ex/images/Hot_Air_Balloons.jpg'" src=
|
3934
|
+
"ex/images/Hot_Air_Balloons.jpg" alt="cycle_colormap example"
|
3935
|
+
title=
|
3936
|
+
"Click the image to see the example script" /></a><img src=
|
3937
|
+
"ex/images/spin.gif" alt="" class="spin" style="left: 191px;"
|
3938
|
+
title="Mouse over the example to see the animation" /></p>
|
3939
|
+
|
3940
|
+
<h4>Magick API</h4>
|
3941
|
+
|
3942
|
+
<p>CycleColormapImage</p>
|
3943
|
+
</div>
|
3944
|
+
|
3945
|
+
<div class="sig">
|
3946
|
+
<h3 id="decipher">decipher</h3>
|
3947
|
+
|
3948
|
+
<p><span class="arg">img</span>.decipher(<span class=
|
3949
|
+
"arg">passphrase</span>) -> <em>image</em></p>
|
3950
|
+
</div>
|
3951
|
+
|
3952
|
+
<div class="desc">
|
3953
|
+
<h4>Description</h4>
|
3954
|
+
|
3955
|
+
<p>Decipher an enciphered image.</p>
|
3956
|
+
|
3957
|
+
<h4>Arguments</h4>
|
3958
|
+
|
3959
|
+
<p>The passphrase used to encipher the image.</p>
|
3960
|
+
|
3961
|
+
<h4>Returns</h4>
|
3962
|
+
|
3963
|
+
<p>A new image</p>
|
3964
|
+
|
3965
|
+
<h4>Example</h4>
|
3966
|
+
<pre>
|
3967
|
+
deciphered_img = img.decipher("magic word")
|
3968
|
+
</pre>
|
3969
|
+
|
3970
|
+
<h4>Magick API</h4>
|
3971
|
+
|
3972
|
+
<p>DecipherImage</p>
|
3973
|
+
|
3974
|
+
<h4>See also</h4>
|
3975
|
+
|
3976
|
+
<p><a href="image2.html#encipher">encipher</a></p>
|
3977
|
+
</div>
|
3978
|
+
|
3979
|
+
<div class="sig">
|
3980
|
+
<h3 id="delete_compose_mask">delete_compose_mask</h3>
|
3981
|
+
|
3982
|
+
<p><span class="arg">img</span>.delete_compose_mask() ->
|
3983
|
+
<em>self</em></p>
|
3984
|
+
</div>
|
3985
|
+
|
3986
|
+
<div class="desc">
|
3987
|
+
<h4>Description</h4>
|
3988
|
+
|
3989
|
+
<p>Deletes the mask added by <a href=
|
3990
|
+
"#add_compose_mask">add_compose_mask</a>.</p>
|
3991
|
+
|
3992
|
+
<h4>Returns</h4>
|
3993
|
+
|
3994
|
+
<p>self</p>
|
3995
|
+
|
3996
|
+
<h4>See also</h4>
|
3997
|
+
|
3998
|
+
<p><a href="#add_compose_mask">add_compose_mask</a></p>
|
3999
|
+
|
4000
|
+
<h4>Magick API</h4>
|
4001
|
+
|
4002
|
+
<p>SetImageMask</p>
|
4003
|
+
</div>
|
4004
|
+
|
4005
|
+
<div class="sig">
|
4006
|
+
<h3 id="delete_profile">delete_profile</h3>
|
4007
|
+
|
4008
|
+
<p><span class="arg">img</span>.delete_profile(<span class=
|
4009
|
+
"arg">profile_name</span>) -> <span class=
|
4010
|
+
"arg">self</span></p>
|
4011
|
+
</div>
|
4012
|
+
|
4013
|
+
<div class="desc">
|
4014
|
+
<h4>Description</h4>
|
4015
|
+
|
4016
|
+
<p>Deletes the specified profile. This method is effectively
|
4017
|
+
the same as passing a <code>nil</code> 2nd argument to <a href=
|
4018
|
+
"image3.html#profile_bang">profile!</a>.</p>
|
4019
|
+
|
4020
|
+
<h4>Arguments</h4>
|
4021
|
+
|
4022
|
+
<p>The profile name, "IPTC" or "ICC" for example. Specify "*"
|
4023
|
+
to delete all the profiles in the image.</p>
|
4024
|
+
|
4025
|
+
<h4>See also</h4>
|
4026
|
+
|
4027
|
+
<p>Setting the <a href=
|
4028
|
+
"imageattrs.html#iptc_profile">iptc_profile</a> attribute or
|
4029
|
+
<a href="imageattrs.html#color_profile">color_profile</a>
|
4030
|
+
attribute to nil causes the profile to be deleted. Also see
|
4031
|
+
<a href="image3.html#strip_bang">strip!</a> and <a href=
|
4032
|
+
"imageattrs.html#add_profile">add_profile</a>.</p>
|
4033
|
+
|
4034
|
+
<h4>Magick API</h4>
|
4035
|
+
|
4036
|
+
<p>ProfileImage</p>
|
4037
|
+
</div>
|
4038
|
+
|
4039
|
+
<div class="sig">
|
4040
|
+
<h3 id="deskew">deskew</h3>
|
4041
|
+
|
4042
|
+
<p><span class="arg">img</span>.deskew(<span class=
|
4043
|
+
"arg">threshold</span>=0.40, <span class=
|
4044
|
+
"arg">auto_crop_width</span>=nil) -> <em>image</em></p>
|
4045
|
+
</div>
|
4046
|
+
|
4047
|
+
<div class="desc">
|
4048
|
+
<h4>Description</h4>
|
4049
|
+
|
4050
|
+
<p class="imquote">Straightens an image. A <span class=
|
4051
|
+
"arg">threshold</span> of 40% works for most images.</p>
|
4052
|
+
|
4053
|
+
<h4>Arguments</h4>
|
4054
|
+
|
4055
|
+
<dl>
|
4056
|
+
<dt>threshold</dt>
|
4057
|
+
|
4058
|
+
<dd>A percentage of QuantumRange. Either a Float between 0
|
4059
|
+
and 1.0, inclusive, or a string in the form "NN%" where NN is
|
4060
|
+
between 0 and 100.</dd>
|
4061
|
+
|
4062
|
+
<dt>auto_crop_width</dt>
|
4063
|
+
|
4064
|
+
<dd>Specify a value for this argument to cause the deskewed
|
4065
|
+
image to be auto-cropped. The argument is the pixel width of
|
4066
|
+
the image background (e.g. 40).</dd>
|
4067
|
+
</dl>
|
4068
|
+
|
4069
|
+
<h4>Returns</h4>
|
4070
|
+
|
4071
|
+
<p>A new image</p>
|
4072
|
+
|
4073
|
+
<h4>Example</h4>
|
4074
|
+
<pre>
|
4075
|
+
img2 = img.deskew
|
4076
|
+
</pre>
|
4077
|
+
|
4078
|
+
<h4>Magick API</h4>DeskewImage (available in 6.4.2)
|
4079
|
+
</div>
|
4080
|
+
|
4081
|
+
<div class="sig">
|
4082
|
+
<h3 id="despeckle">despeckle</h3>
|
4083
|
+
|
4084
|
+
<p><span class="arg">img</span>.despeckle ->
|
4085
|
+
<em>image</em></p>
|
4086
|
+
</div>
|
4087
|
+
|
4088
|
+
<div class="desc">
|
4089
|
+
<h4>Description</h4>
|
4090
|
+
|
4091
|
+
<p class="imquote">Reduces the speckle noise while preserving
|
4092
|
+
the edges.</p>
|
4093
|
+
|
4094
|
+
<h4>Returns</h4>
|
4095
|
+
|
4096
|
+
<p>A new image</p>
|
4097
|
+
|
4098
|
+
<h4>Magick API</h4>
|
4099
|
+
|
4100
|
+
<p>DespeckleImage</p>
|
4101
|
+
</div>
|
4102
|
+
|
4103
|
+
<div class="sig">
|
4104
|
+
<h3 id="destroy_bang">destroy!</h3>
|
4105
|
+
|
4106
|
+
<p><span class="arg">img</span>.destroy! ->
|
4107
|
+
<em>self</em></p>
|
4108
|
+
</div>
|
4109
|
+
|
4110
|
+
<div class="desc">
|
4111
|
+
<h4>Description</h4>
|
4112
|
+
|
4113
|
+
<p>Returns all the memory associated with the image to the
|
4114
|
+
system. After an image has been destroyed, all Image methods
|
4115
|
+
(except <a href="image1.html#destroyed_q">destroyed?</a> and
|
4116
|
+
<a href="image2.html#inspect">inspect</a>) called on the image
|
4117
|
+
will raise a DestroyedImageError.</p>
|
4118
|
+
|
4119
|
+
<p>It is not possible to recover a destroyed image.</p>
|
4120
|
+
|
4121
|
+
<h4>Returns</h4>
|
4122
|
+
|
4123
|
+
<p>self</p>
|
4124
|
+
|
4125
|
+
<h4>See also</h4>
|
4126
|
+
|
4127
|
+
<p><a href="#check_destroyed">check_destroyed</a>, <a href=
|
4128
|
+
"#destroyed_q">destroyed?</a></p>
|
4129
|
+
</div>
|
4130
|
+
|
4131
|
+
<div class="sig">
|
4132
|
+
<h3 id="destroyed_q">destroyed?</h3>
|
4133
|
+
|
4134
|
+
<p><span class="arg">img</span>.destroyed? ->
|
4135
|
+
<code>true</code> or <code>false</code></p>
|
4136
|
+
</div>
|
4137
|
+
|
4138
|
+
<div class="desc">
|
4139
|
+
<h4>Description</h4>
|
4140
|
+
|
4141
|
+
<p>Returns true if the image has been destroyed, false
|
4142
|
+
otherwise.</p>
|
4143
|
+
|
4144
|
+
<h4>See also</h4>
|
4145
|
+
|
4146
|
+
<p><a href="#check_destroyed">check_destroyed</a>, <a href=
|
4147
|
+
"#destroy_bang">destroy!</a></p>
|
4148
|
+
</div>
|
4149
|
+
|
4150
|
+
<div class="sig">
|
4151
|
+
<h3 id="difference">difference</h3>
|
4152
|
+
|
4153
|
+
<p><span class="arg">img</span>.difference(<span class=
|
4154
|
+
"arg">other</span>) -> <em>array</em></p>
|
4155
|
+
</div>
|
4156
|
+
|
4157
|
+
<div class="desc">
|
4158
|
+
<h4>Description</h4>
|
4159
|
+
|
4160
|
+
<p class="imquote">Compares two images and computes statistics
|
4161
|
+
about their difference.</p>
|
4162
|
+
|
4163
|
+
<p class="imquote">A small normalized mean square
|
4164
|
+
error...suggests the images are very similar in spatial layout
|
4165
|
+
and color.</p>
|
4166
|
+
|
4167
|
+
<h4>Returns</h4>
|
4168
|
+
|
4169
|
+
<p>An array of three <code>Float</code> values:</p>
|
4170
|
+
|
4171
|
+
<dl class="imquote">
|
4172
|
+
<dt>mean error per pixel</dt>
|
4173
|
+
|
4174
|
+
<dd>The mean error for any single pixel in the image.</dd>
|
4175
|
+
|
4176
|
+
<dt>normalized mean error</dt>
|
4177
|
+
|
4178
|
+
<dd>The normalized mean quantization error for any single
|
4179
|
+
pixel in the image. This distance measure is normalized to a
|
4180
|
+
range between 0 and 1. It is independent of the range of red,
|
4181
|
+
green, and blue values in the image.</dd>
|
4182
|
+
|
4183
|
+
<dt>normalized maximum error</dt>
|
4184
|
+
|
4185
|
+
<dd>The normalized maximum quantization error for any single
|
4186
|
+
pixel in the image. This distance measure is normalized to a
|
4187
|
+
range between 0 and 1. It is independent of the range of red,
|
4188
|
+
green, and blue values in your image.</dd>
|
4189
|
+
</dl>
|
4190
|
+
|
4191
|
+
<p>After <code>difference</code> returns, these values are also
|
4192
|
+
available from the <a href=
|
4193
|
+
"imageattrs.html#mean_error_per_pixel">mean_error_per_pixel</a>,
|
4194
|
+
<a href=
|
4195
|
+
"imageattrs.html#normalized_mean_error">normalized_mean_error</a>,
|
4196
|
+
and <a href=
|
4197
|
+
"imageattrs.html#normalized_maximum_error">normalized_maximum_error</a>
|
4198
|
+
attributes.</p>
|
4199
|
+
|
4200
|
+
<h4>See also</h4>
|
4201
|
+
|
4202
|
+
<p><a href="#spaceship"><=></a></p>
|
4203
|
+
|
4204
|
+
<h4>Magick API</h4>IsImagesEqual
|
4205
|
+
</div>
|
4206
|
+
|
4207
|
+
<div class="sig">
|
4208
|
+
<h3 id="dispatch">dispatch</h3>
|
4209
|
+
|
4210
|
+
<p><span class="arg">img</span>.dispatch(<span class=
|
4211
|
+
"arg">x</span>, <span class="arg">y</span>, <span class=
|
4212
|
+
"arg">columns</span>, <span class="arg">rows</span>,
|
4213
|
+
<span class="arg">map</span>, <span class=
|
4214
|
+
"arg">float</span>=<code>false</code>) -> <em>array</em></p>
|
4215
|
+
</div>
|
4216
|
+
|
4217
|
+
<div class="desc">
|
4218
|
+
<h4>Description</h4>
|
4219
|
+
|
4220
|
+
<p>Extracts the pixel data from the specified rectangle and
|
4221
|
+
returns it as an array of either <code>Integer</code> or
|
4222
|
+
<code>Float</code> values.</p>
|
4223
|
+
|
4224
|
+
<p>The array returned by <code>dispatch</code> is suitable for
|
4225
|
+
use as an argument to <code>constitute</code>.</p>
|
4226
|
+
|
4227
|
+
<h4>Arguments</h4>
|
4228
|
+
|
4229
|
+
<dl>
|
4230
|
+
<dt>x, y</dt>
|
4231
|
+
|
4232
|
+
<dd>The offset of the rectangle from the upper-left corner of
|
4233
|
+
the image.</dd>
|
4234
|
+
|
4235
|
+
<dt>columns, rows</dt>
|
4236
|
+
|
4237
|
+
<dd>The width and height of the rectangle.</dd>
|
4238
|
+
|
4239
|
+
<dt>map</dt>
|
4240
|
+
|
4241
|
+
<dd>A <code>String</code> reflecting the order of the pixel
|
4242
|
+
data. <span class="imquote">It can be any combination or
|
4243
|
+
order of R = red, G = green, B = blue, A = alpha, C = cyan, Y
|
4244
|
+
= yellow, M = magenta, K = black, or I = intensity (for
|
4245
|
+
grayscale).</span></dd>
|
4246
|
+
|
4247
|
+
<dt>float</dt>
|
4248
|
+
|
4249
|
+
<dd>If <code>true</code>, the returned array elements will be
|
4250
|
+
<code>Float</code> values in the range 0..1. If
|
4251
|
+
<code>false</code>, the returned array elements will be
|
4252
|
+
<code>Integer</code> values in the range
|
4253
|
+
0..QuantumRange.</dd>
|
4254
|
+
</dl>
|
4255
|
+
|
4256
|
+
<h4>Returns</h4>An array
|
4257
|
+
|
4258
|
+
<h4>Example</h4>
|
4259
|
+
<pre>
|
4260
|
+
pixels = f.dispatch(0, 0, f.columns, f.rows, "RGB")
|
4261
|
+
</pre>
|
4262
|
+
|
4263
|
+
<h4>See also</h4>
|
4264
|
+
|
4265
|
+
<p><a href="#constitute">constitute</a>, <a href=
|
4266
|
+
"image2.html#export_pixels">export_pixels</a>, <a href=
|
4267
|
+
"image2.html#get_pixels">get_pixels</a></p>
|
4268
|
+
|
4269
|
+
<h4>Magick API</h4>
|
4270
|
+
|
4271
|
+
<p>ExportImagePixels</p>
|
4272
|
+
|
4273
|
+
<h4>Note</h4>
|
4274
|
+
|
4275
|
+
<p>This method is deprecated in ImageMagick. Use the
|
4276
|
+
<code>export_pixels</code> method instead.</p>
|
4277
|
+
</div>
|
4278
|
+
|
4279
|
+
<div class="sig">
|
4280
|
+
<h3 id="displace">displace</h3>
|
4281
|
+
|
4282
|
+
<p><span class="arg">img</span>.displace(<span class=
|
4283
|
+
"arg">displacement_map</span>, <span class=
|
4284
|
+
"arg">x_amplitude</span>, <span class="arg">y_amplitude</span>,
|
4285
|
+
<span class="arg">x_offset</span>=0, <span class=
|
4286
|
+
"arg">y_offset</span>=0) -> <em>image</em><br />
|
4287
|
+
<span class="arg">img</span>.displace(<span class=
|
4288
|
+
"arg">displacement_map</span>, <span class=
|
4289
|
+
"arg">x_amplitude</span>, <span class="arg">y_amplitude</span>,
|
4290
|
+
<span class="arg">gravity</span>, <span class=
|
4291
|
+
"arg">x_offset</span>=0, <span class="arg">y_offset</span>=0)
|
4292
|
+
-> <em>image</em></p>
|
4293
|
+
</div>
|
4294
|
+
|
4295
|
+
<div class="desc">
|
4296
|
+
<h4>Description</h4>
|
4297
|
+
|
4298
|
+
<p>Uses <span class="arg">displacement_map</span> to move color
|
4299
|
+
from <span class="arg">img</span> to the output image.</p>
|
4300
|
+
|
4301
|
+
<p>This method corresponds to the -displace option of
|
4302
|
+
ImageMagick's <code>composite</code> command.</p>
|
4303
|
+
|
4304
|
+
<h4>Arguments</h4>
|
4305
|
+
|
4306
|
+
<dl>
|
4307
|
+
<dt>displacement_map</dt>
|
4308
|
+
|
4309
|
+
<dd>The source image for the composite operation. Either an
|
4310
|
+
imagelist or an image. If an imagelist, uses the current
|
4311
|
+
image.</dd>
|
4312
|
+
|
4313
|
+
<dt>x_amplitude</dt>
|
4314
|
+
|
4315
|
+
<dd>The maximum displacement on the x-axis.</dd>
|
4316
|
+
|
4317
|
+
<dt>y_amplitude</dt>
|
4318
|
+
|
4319
|
+
<dd>The maximum displacement on the y-axis. This argument may
|
4320
|
+
omitted if no other arguments follow it. In this case the
|
4321
|
+
default is the value of <span class=
|
4322
|
+
"arg">x_amplitude</span>.</dd>
|
4323
|
+
</dl>
|
4324
|
+
|
4325
|
+
<p>The <code>displace</code> method can be called with or
|
4326
|
+
without a <span class="arg">gravity</span> argument. The
|
4327
|
+
<span class="arg">gravity</span>, <span class=
|
4328
|
+
"arg">x_offset</span>, and <span class="arg">y_offset</span>
|
4329
|
+
arguments are described in the documentation for <a href=
|
4330
|
+
"image3.html#watermark">watermark</a>.</p>
|
4331
|
+
|
4332
|
+
<h4>Example</h4>
|
4333
|
+
|
4334
|
+
<p>See <a href=
|
4335
|
+
"http://www.cit.gu.edu.au/~anthony/graphics/imagick6/compose/#displace">
|
4336
|
+
"Composite Displacement Maps"</a> in Anthony Thyssen's
|
4337
|
+
<cite><a href=
|
4338
|
+
"http://www.cit.gu.edu.au/~anthony/graphics/imagick6/">Examples
|
4339
|
+
of ImageMagick Usage</a></cite>.</p>
|
4340
|
+
|
4341
|
+
<h4>Returns</h4>
|
4342
|
+
|
4343
|
+
<p>A new image</p>
|
4344
|
+
|
4345
|
+
<h4>See also</h4>
|
4346
|
+
|
4347
|
+
<p><a href="#composite">composite</a></p>
|
4348
|
+
</div>
|
4349
|
+
|
4350
|
+
<div class="sig">
|
4351
|
+
<h3 id="display">display</h3>
|
4352
|
+
|
4353
|
+
<p><span class="arg">img</span>.display [ <span class="arg">{
|
4354
|
+
optional arguments }</span> ] -> <em>self</em></p>
|
4355
|
+
</div>
|
4356
|
+
|
4357
|
+
<div class="desc">
|
4358
|
+
<h4>Description</h4>
|
4359
|
+
|
4360
|
+
<p>Display the image on an X Window screen. By default, the
|
4361
|
+
screen is the local monitor. Right-click the window to display
|
4362
|
+
a context menu.</p>
|
4363
|
+
|
4364
|
+
<h4>Arguments</h4>
|
4365
|
+
|
4366
|
+
<p>You can specify additional arguments by setting Info
|
4367
|
+
attributes in a block associated with the method call.
|
4368
|
+
Specifically, you can set the name of a non-default X Window
|
4369
|
+
screen with the <code><a href=
|
4370
|
+
"info.html#Info.server_name_eq">server_name</a></code>
|
4371
|
+
attribute.</p>
|
4372
|
+
|
4373
|
+
<h4>Returns</h4>
|
4374
|
+
|
4375
|
+
<p>self</p>
|
4376
|
+
|
4377
|
+
<h4>Note</h4>
|
4378
|
+
|
4379
|
+
<p>The display method is not supported on native MS
|
4380
|
+
Windows.</p>
|
4381
|
+
|
4382
|
+
<h4>Magick API</h4>
|
4383
|
+
|
4384
|
+
<p>DisplayImages</p>
|
4385
|
+
</div>
|
4386
|
+
|
4387
|
+
<div class="sig">
|
4388
|
+
<h3 id="dissolve">dissolve</h3>
|
4389
|
+
|
4390
|
+
<p><span class="arg">img</span>.dissolve(<span class=
|
4391
|
+
"arg">overlay</span>, <span class="arg">src_percentage</span>,
|
4392
|
+
<span class="arg">dst_percentage</span>, <span class=
|
4393
|
+
"arg">x_offset</span>=0, <span class="arg">y_offset</span>=0)
|
4394
|
+
-> <em>image</em><br />
|
4395
|
+
<span class="arg">img</span>.dissolve(<span class=
|
4396
|
+
"arg">overlay</span>, <span class="arg">src_percentage</span>,
|
4397
|
+
<span class="arg">dst_percentage</span>, <span class=
|
4398
|
+
"arg">gravity</span>, <span class="arg">x_offset</span>=0,
|
4399
|
+
<span class="arg">y_offset</span>=0) -> <em>image</em></p>
|
4400
|
+
</div>
|
4401
|
+
|
4402
|
+
<div class="desc">
|
4403
|
+
<h4>Description</h4>
|
4404
|
+
|
4405
|
+
<p>Composites the <span class="arg">overlay</span> image into
|
4406
|
+
the target image. The opacity of <span class="arg">img</span>
|
4407
|
+
is multiplied by <span class="arg">dst_percentage</span> and
|
4408
|
+
opacity of <span class="arg">overlay</span> is multiplied by
|
4409
|
+
<span class="arg">src_percentage</span>.</p>
|
4410
|
+
|
4411
|
+
<p>This method corresponds to the -dissolve option of
|
4412
|
+
ImageMagick's <code>composite</code> command.</p>
|
4413
|
+
|
4414
|
+
<h4>Arguments</h4>
|
4415
|
+
|
4416
|
+
<dl>
|
4417
|
+
<dt>overlay</dt>
|
4418
|
+
|
4419
|
+
<dd>The source image for the composite operation. Either an
|
4420
|
+
imagelist or an image. If an imagelist, uses the current
|
4421
|
+
image.</dd>
|
4422
|
+
|
4423
|
+
<dt>src_percentage</dt>
|
4424
|
+
|
4425
|
+
<dd>Either a non-negative number a string in the form "NN%".
|
4426
|
+
If <span class="arg">src_percentage</span> is a number it is
|
4427
|
+
interpreted as a percentage. Both 0.25 and "25%" mean 25%.
|
4428
|
+
This argument is required.</dd>
|
4429
|
+
|
4430
|
+
<dt>dst_percentage</dt>
|
4431
|
+
|
4432
|
+
<dd>Either a non-negative number a string in the form "NN%".
|
4433
|
+
If <span class="arg">src_percentage</span> is a number it is
|
4434
|
+
interpreted as a percentage. Both 0.25 and "25%" mean 25%.
|
4435
|
+
This argument may omitted if no other arguments follow it. In
|
4436
|
+
this case <span class="arg">img</span>'s opacity is
|
4437
|
+
unchanged.</dd>
|
4438
|
+
</dl>
|
4439
|
+
|
4440
|
+
<p>The <code>dissolve</code> method can be called with or
|
4441
|
+
without a <span class="arg">gravity</span> argument. The
|
4442
|
+
<span class="arg">gravity</span>, <span class=
|
4443
|
+
"arg">x_offset</span>, and <span class="arg">y_offset</span>
|
4444
|
+
arguments are described in the documentation for <a href=
|
4445
|
+
"image3.html#watermark">watermark</a>.</p>
|
4446
|
+
|
4447
|
+
<h4>Example</h4>
|
4448
|
+
|
4449
|
+
<p>See " <a href=
|
4450
|
+
"http://www.cit.gu.edu.au/~anthony/graphics/imagick6/compose/#dissolve">
|
4451
|
+
Dissolve One Image Over Another</a>" in Anthony Thyssen's
|
4452
|
+
<cite><a href=
|
4453
|
+
"http://www.cit.gu.edu.au/~anthony/graphics/imagick6/">Examples
|
4454
|
+
of ImageMagick Usage</a></cite>.</p>
|
4455
|
+
|
4456
|
+
<p><code>bgnd.dissolve(overlay, 0.50, 1.0)</code></p>
|
4457
|
+
|
4458
|
+
<p class="rollover"><a href=
|
4459
|
+
"javascript:popup('dissolve.rb.html')"><img onmouseover=
|
4460
|
+
"this.src='ex/images/Flower_Hat.jpg'" onmouseout=
|
4461
|
+
"this.src='ex/dissolve.jpg'" src="ex/dissolve.jpg" alt=
|
4462
|
+
"dissolve example" title=
|
4463
|
+
"Click to see the example script" /></a> <img src=
|
4464
|
+
"ex/images/spin.gif" alt="" class="spin" title=
|
4465
|
+
"Mouse over the example to see the original image" /></p>
|
4466
|
+
|
4467
|
+
<h4>Returns</h4>
|
4468
|
+
|
4469
|
+
<p>A new image</p>
|
4470
|
+
|
4471
|
+
<h4>See also</h4>
|
4472
|
+
|
4473
|
+
<p><a href="#blend">blend</a>, <a href=
|
4474
|
+
"#composite">composite</a></p>
|
4475
|
+
</div>
|
4476
|
+
|
4477
|
+
<div class="sig">
|
4478
|
+
<h3 id="distort">distort</h3>
|
4479
|
+
|
4480
|
+
<p><span class="arg">img</span>.distort(<span class=
|
4481
|
+
"arg">type</span>, <span class="arg">points</span>,
|
4482
|
+
<span class="arg">bestfit</span>=<code>false</code>) [
|
4483
|
+
<span class="arg">{ optional arguments }</span> ]
|
4484
|
+
-> <em>image</em></p>
|
4485
|
+
</div>
|
4486
|
+
|
4487
|
+
<div class="desc">
|
4488
|
+
<h4>Description</h4>
|
4489
|
+
|
4490
|
+
<p>Distort an image using the specified distortion type and its
|
4491
|
+
required arguments. This method is equivalent to ImageMagick's
|
4492
|
+
-distort option.</p>
|
4493
|
+
|
4494
|
+
<h4>Arguments</h4>
|
4495
|
+
|
4496
|
+
<dl>
|
4497
|
+
<dt>type</dt>
|
4498
|
+
|
4499
|
+
<dd>
|
4500
|
+
One of the following values:
|
4501
|
+
|
4502
|
+
<ul>
|
4503
|
+
<li>AffineDistortion</li>
|
4504
|
+
|
4505
|
+
<li>AffineProjectionDistortion</li>
|
4506
|
+
|
4507
|
+
<li>ArcDistortion</li>
|
4508
|
+
|
4509
|
+
<li>BarrelDistortion</li>
|
4510
|
+
|
4511
|
+
<li>BarrelInverseDistortion</li>
|
4512
|
+
|
4513
|
+
<li>BilinearDistortion</li>
|
4514
|
+
|
4515
|
+
<li>PerspectiveDistortion</li>
|
4516
|
+
|
4517
|
+
<li>PerspectiveProjectionDistortion</li>
|
4518
|
+
|
4519
|
+
<li>PolynomialDistortion</li>
|
4520
|
+
|
4521
|
+
<li>ScaleRotateTranslateDistortion</li>
|
4522
|
+
|
4523
|
+
<li>ShepardsDistortion</li>
|
4524
|
+
</ul>
|
4525
|
+
</dd>
|
4526
|
+
|
4527
|
+
<dt>points</dt>
|
4528
|
+
|
4529
|
+
<dd>An array of numbers. The size of the array depends on the
|
4530
|
+
distortion type.</dd>
|
4531
|
+
|
4532
|
+
<dt>bestfit</dt>
|
4533
|
+
|
4534
|
+
<dd class="imquote">If <span class="arg">bestfit</span> is
|
4535
|
+
enabled, and the distortion allows it, the destination image
|
4536
|
+
is adjusted to ensure the whole source image will just fit
|
4537
|
+
within the final destination image, which will be sized and
|
4538
|
+
offset accordingly. Also in many cases the virtual offset of
|
4539
|
+
the source image will be taken into account in the
|
4540
|
+
mapping.</dd>
|
4541
|
+
|
4542
|
+
<dt>optional arguments</dt>
|
4543
|
+
|
4544
|
+
<dd>
|
4545
|
+
If present, <code>distort</code> yields to a block in which
|
4546
|
+
you can set optional arguments by calling methods on
|
4547
|
+
<em>self</em>.
|
4548
|
+
|
4549
|
+
<dl>
|
4550
|
+
<dt>self.define("distort:viewport", "WxH+X+Y")</dt>
|
4551
|
+
|
4552
|
+
<dd>Specify the size and offset of the generated viewport
|
4553
|
+
image of the distorted image space. W and H are the width
|
4554
|
+
and height, and X and Y are the offset.</dd>
|
4555
|
+
|
4556
|
+
<dt>self.define("distort:scale", N)</dt>
|
4557
|
+
|
4558
|
+
<dd>N is an integer factor. <span class="imquote">Scale
|
4559
|
+
the output image (viewport or otherwise) by that factor
|
4560
|
+
without changing the viewed contents of the distorted
|
4561
|
+
image. This can be used either for 'super-sampling' the
|
4562
|
+
image for a higher quality result, or for panning and
|
4563
|
+
zooming around the image (with appropriate viewport
|
4564
|
+
changes, or post-distort cropping and
|
4565
|
+
resizing).</span></dd>
|
4566
|
+
|
4567
|
+
<dt>self.verbose(true)</dt>
|
4568
|
+
|
4569
|
+
<dd class="imquote">Attempt to output the internal
|
4570
|
+
coefficients, and the -fx equivalent to the distortion,
|
4571
|
+
for expert study, and debugging purposes. This many not
|
4572
|
+
be available for all distorts.</dd>
|
4573
|
+
</dl>
|
4574
|
+
</dd>
|
4575
|
+
</dl>
|
4576
|
+
|
4577
|
+
<h4>Returns</h4>
|
4578
|
+
|
4579
|
+
<p>A new image</p>
|
4580
|
+
|
4581
|
+
<h4>Example</h4>
|
4582
|
+
<pre>
|
4583
|
+
result = img.distort(Magick::ScaleRotateTranslateDistortion, [0]) do
|
4584
|
+
self.define "distort:viewport", "44x44+15+0"
|
4585
|
+
self.define "distort:scale", 2
|
4586
|
+
end
|
4587
|
+
</pre>
|
4588
|
+
|
4589
|
+
<h4>Note</h4>
|
4590
|
+
|
4591
|
+
<p>See <a href=
|
4592
|
+
"http://www.imagemagick.org/Usage/distorts/#distort">Distortion
|
4593
|
+
Operator</a> in Anthony Thyssen's excellent <a href=
|
4594
|
+
"http://www.imagemagick.org/Usage/">Examples of ImageMagick
|
4595
|
+
Usage</a> for more information about distortion operations.</p>
|
4596
|
+
</div>
|
4597
|
+
|
4598
|
+
<div class="sig">
|
4599
|
+
<h3 id="distortion_channel">distortion_channel</h3>
|
4600
|
+
|
4601
|
+
<p><span class="arg">img</span>.distortion_channel(<span class=
|
4602
|
+
"arg">reconstructed_image</span>, <span class=
|
4603
|
+
"arg">metric</span>[, <span class="arg">channel</span>...])
|
4604
|
+
-> <em>float</em></p>
|
4605
|
+
</div>
|
4606
|
+
|
4607
|
+
<div class="desc">
|
4608
|
+
<h4>Description</h4>
|
4609
|
+
|
4610
|
+
<p class="imquote">(C)ompares one or more image channels of an
|
4611
|
+
image to a reconstructed image and returns the specified
|
4612
|
+
distortion metric.</p>
|
4613
|
+
|
4614
|
+
<h4>Arguments</h4>
|
4615
|
+
|
4616
|
+
<dl>
|
4617
|
+
<dt>reconstructed_image</dt>
|
4618
|
+
|
4619
|
+
<dd>Either an imagelist or an image. If an imagelist, uses
|
4620
|
+
the current image.</dd>
|
4621
|
+
|
4622
|
+
<dt>metric</dt>
|
4623
|
+
|
4624
|
+
<dd>The desired distortion metric. A <a href=
|
4625
|
+
"constants.html#MetricType">MetricType</a> value.</dd>
|
4626
|
+
|
4627
|
+
<dt>channel...</dt>
|
4628
|
+
|
4629
|
+
<dd>Zero or more <a href=
|
4630
|
+
"constants.html##ChannelType">ChannelType</a> values. All the
|
4631
|
+
specified channels contribute to the comparison and the
|
4632
|
+
distortion value. If no channels are specified, compares all
|
4633
|
+
channels.</dd>
|
4634
|
+
</dl>
|
4635
|
+
|
4636
|
+
<h4>Returns</h4>
|
4637
|
+
|
4638
|
+
<p>The distortion metric, represented as a floating-point
|
4639
|
+
number.</p>
|
4640
|
+
|
4641
|
+
<h4>Magick API</h4>
|
4642
|
+
|
4643
|
+
<p>GetImageChannelDistortion</p>
|
4644
|
+
|
4645
|
+
<h4>See also</h4>
|
4646
|
+
|
4647
|
+
<p><a href="#compare_channel">compare_channel</a>, <a href=
|
4648
|
+
"#difference">difference</a></p>
|
4649
|
+
</div>
|
4650
|
+
|
4651
|
+
<div class="sig">
|
4652
|
+
<h3 id="dup">dup</h3>
|
4653
|
+
|
4654
|
+
<p><span class="arg">img</span>.dup ->
|
4655
|
+
<em>other_image</em></p>
|
4656
|
+
</div>
|
4657
|
+
|
4658
|
+
<div class="desc">
|
4659
|
+
<h4>Description</h4>
|
4660
|
+
|
4661
|
+
<p>Same as <a href="#copy">copy</a>.</p>
|
4662
|
+
|
4663
|
+
<h4>Returns</h4>
|
4664
|
+
|
4665
|
+
<p>A new image</p>
|
4666
|
+
|
4667
|
+
<h4>See also</h4>
|
4668
|
+
|
4669
|
+
<p><a href="#clone">clone</a></p>
|
4670
|
+
</div>
|
4671
|
+
|
4672
|
+
<p class="spacer"> </p>
|
4673
|
+
|
4674
|
+
<div class="nav">
|
4675
|
+
« <a href="imageattrs.html">Prev</a> | <a href=
|
4676
|
+
"index.html">Contents</a> | <a href=
|
4677
|
+
"image2.html">Next</a> »
|
4678
|
+
</div>
|
4679
|
+
</body>
|
4680
|
+
</html>
|