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/usage.html
ADDED
@@ -0,0 +1,1621 @@
|
|
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: How to use RMagick</title>
|
10
|
+
<meta http-equiv="Content-Type" content=
|
11
|
+
"text/html; charset=us-ascii" />
|
12
|
+
<meta name="GENERATOR" content="Quanta Plus" />
|
13
|
+
<meta name="Copyright" content=
|
14
|
+
"Copyright (C) 2006 by Timothy P. Hunter" />
|
15
|
+
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
16
|
+
<script type="text/javascript" src="scripts/doc.js">
|
17
|
+
</script>
|
18
|
+
<style type="text/css">
|
19
|
+
/*<![CDATA[*/
|
20
|
+
|
21
|
+
/* Styles local to this page. */
|
22
|
+
|
23
|
+
#index {
|
24
|
+
margin-left: 100px;
|
25
|
+
margin-right: 100px;
|
26
|
+
}
|
27
|
+
#index h4 {
|
28
|
+
position: relative;
|
29
|
+
left: -100px;
|
30
|
+
padding-left: 5px;
|
31
|
+
background-image: url(ex/images/graydient230x6.gif);
|
32
|
+
background-repeat: repeat-y;
|
33
|
+
color: black;
|
34
|
+
}
|
35
|
+
|
36
|
+
/*
|
37
|
+
* The "ilist" class identifies ImageList methods in the index.
|
38
|
+
*/
|
39
|
+
.ilist {
|
40
|
+
font-weight: bold;
|
41
|
+
}
|
42
|
+
.ilist a:link {
|
43
|
+
font-weight: bold;
|
44
|
+
text-decoration: none;
|
45
|
+
}
|
46
|
+
.ilist a:visited {
|
47
|
+
font-weight: bold;
|
48
|
+
color: #7f7fff;
|
49
|
+
}
|
50
|
+
.ilist a:hover {
|
51
|
+
text-decoration: underline;
|
52
|
+
}
|
53
|
+
.ilist a:active {
|
54
|
+
background-color: blue;
|
55
|
+
color: white;
|
56
|
+
text-decoration: underline;
|
57
|
+
}
|
58
|
+
|
59
|
+
#axes {
|
60
|
+
margin-left:100px;
|
61
|
+
margin-right:100px;
|
62
|
+
margin-bottom: 1em;
|
63
|
+
position:relative;
|
64
|
+
}
|
65
|
+
#axes div {
|
66
|
+
position:absolute;
|
67
|
+
top:0;
|
68
|
+
left: 260px;
|
69
|
+
}
|
70
|
+
#rubyname {
|
71
|
+
margin-left: auto;
|
72
|
+
margin-right:auto;
|
73
|
+
width:300px;
|
74
|
+
margin-bottom:1em;
|
75
|
+
}
|
76
|
+
#footnotes {
|
77
|
+
border-top: thin solid black;
|
78
|
+
padding-top: 1em;????
|
79
|
+
}
|
80
|
+
#footnotes h5 {
|
81
|
+
display: none;
|
82
|
+
}
|
83
|
+
.sup {
|
84
|
+
vertical-align: super;
|
85
|
+
font-size: x-small;
|
86
|
+
}
|
87
|
+
|
88
|
+
/*]]>*/
|
89
|
+
</style>
|
90
|
+
</head>
|
91
|
+
|
92
|
+
<body>
|
93
|
+
<h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
|
94
|
+
|
95
|
+
<div class="nav">
|
96
|
+
« <a href="index.html">Prev</a> | <a href=
|
97
|
+
"index.html">Contents</a> | <a href=
|
98
|
+
"imusage.html">Next</a> »
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<h1>How to use RMagick</h1>
|
102
|
+
|
103
|
+
<div id="toc">
|
104
|
+
<h2>Table of Contents</h2>
|
105
|
+
|
106
|
+
<ul style="margin-left: 15px; padding-top: 1em">
|
107
|
+
<li><a href="#basics">Basic concepts</a></li>
|
108
|
+
|
109
|
+
<li><a href="#reading">Reading, writing, and creating
|
110
|
+
images</a></li>
|
111
|
+
|
112
|
+
<li><a href="#displaying">Displaying images</a></li>
|
113
|
+
|
114
|
+
<li><a href="#modifying">Examining and modifying
|
115
|
+
images</a></li>
|
116
|
+
|
117
|
+
<li><a href="#marshaling">Marshaling images</a></li>
|
118
|
+
|
119
|
+
<li><a href="#drawing_on">Drawing on and adding text to
|
120
|
+
images</a></li>
|
121
|
+
|
122
|
+
<li><a href="#more">Where to go from here</a></li>
|
123
|
+
</ul>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<h2 id="basics">Basic concepts</h2>
|
127
|
+
|
128
|
+
<p>Let's look at the RMagick equivalent of "Hello, world". This
|
129
|
+
program reads an image file named "Cheetah.jpg" and
|
130
|
+
displays<span class="sup"><a href="#display">1</a></span> it on
|
131
|
+
your monitor</p>
|
132
|
+
<pre class="example">
|
133
|
+
1. require "rmagick"
|
134
|
+
2. include Magick
|
135
|
+
3.
|
136
|
+
4. cat = ImageList.new("Cheetah.jpg")
|
137
|
+
5. cat.display
|
138
|
+
6. exit
|
139
|
+
|
140
|
+
</pre>
|
141
|
+
|
142
|
+
<p class="example_cutline">MS Windows users note: The
|
143
|
+
<span style="font-style:normal">display</span> method does not
|
144
|
+
work on native MS Windows. You must use an external viewer to
|
145
|
+
view the images you create.</p>
|
146
|
+
|
147
|
+
<p>Line 1 requires <span class="sup"><a href=
|
148
|
+
"#rubygems">2</a></span> the RMagick.rb file, which defines the
|
149
|
+
<b>Magick</b> module. The Magick module contains 3 major classes,
|
150
|
+
<b>ImageList</b>, <b>Image</b>, and <b>Draw</b>. This section -
|
151
|
+
<em>Basic Concepts</em> - describes the ImageList and Image
|
152
|
+
classes. The Draw class is explained in the <em><a href=
|
153
|
+
"#drawing">Drawing on and adding text to images</a></em> section,
|
154
|
+
below.</p>
|
155
|
+
|
156
|
+
<p>The statement on line 5 creates an <em>imagelist</em> object
|
157
|
+
and initializes it by reading the <code>Cheetah.jpg</code> file
|
158
|
+
in the current directory. Line 6 sends the <code>display</code>
|
159
|
+
method to the object. When you send <code>display</code> to an
|
160
|
+
imagelist, it causes all the images in the imagelist to be
|
161
|
+
displayed on the default X Window screen. In this case, the
|
162
|
+
<code>display</code> method makes a picture of a cheetah appear
|
163
|
+
on your monitor.</p>
|
164
|
+
|
165
|
+
<p>Type this program in and try running it now. The
|
166
|
+
<code>Cheetah.jpg</code> file is in the <code>ex/images</code>
|
167
|
+
subdirectory where you installed the RMagick documentation.</p>
|
168
|
+
|
169
|
+
<p>The Image and ImageList classes are closely related. An
|
170
|
+
<em>Image</em> object describes one image or one frame in an
|
171
|
+
image with multiple frames. (An animated GIF or a Photoshop image
|
172
|
+
with multiple layers are examples of images with multiple
|
173
|
+
frames.) You can create a image object from an image file such as
|
174
|
+
a GIF, PNG, or JPEG. You can create a image from scratch by
|
175
|
+
specifying its dimensions. You can write an image to disk,
|
176
|
+
display it on a screen, change its size or orientation, convert
|
177
|
+
it to another format, or otherwise modify it using one of over
|
178
|
+
100 methods.</p>
|
179
|
+
|
180
|
+
<p>An <em>ImageList</em> object is a <em>list</em> of images. It
|
181
|
+
contains zero or more images and a <em>scene number</em>. The
|
182
|
+
scene number indicates the <em>current image</em>. The ImageList
|
183
|
+
class includes methods that operate on all the images in the
|
184
|
+
list. Also, with a very few exceptions, any method defined in the
|
185
|
+
Image class can be used as well. Since Image methods always
|
186
|
+
operate on a single image, when an Image method is sent to an
|
187
|
+
imagelist, the ImageList class sends the method to the current
|
188
|
+
image, that is, the image specified by the scene number.</p>
|
189
|
+
|
190
|
+
<p>The ImageList class is a subclass of the Array class, so you
|
191
|
+
can use most Array methods to change the images in the imagelist.
|
192
|
+
For example, you can use the <code><<</code> method to add
|
193
|
+
an image to the list.</p>
|
194
|
+
|
195
|
+
<p>Going back to the example, let's make one modification.</p>
|
196
|
+
<pre class="example">
|
197
|
+
1. require "rmagick"
|
198
|
+
2. include Magick
|
199
|
+
3.
|
200
|
+
4. cat = ImageList.new("Cheetah.jpg")
|
201
|
+
5. smallcat = cat.minify
|
202
|
+
6. smallcat.display
|
203
|
+
7. exit
|
204
|
+
</pre>
|
205
|
+
|
206
|
+
<p>The difference is the statement on line 5. This statement
|
207
|
+
sends the <code>minify</code> method to the imagelist. The
|
208
|
+
<code>minify</code> method is an Image method that reduces the
|
209
|
+
size of an image to half its original size. Remember, since
|
210
|
+
<code>minify</code> is an Image method, the ImageList class sends
|
211
|
+
<code>minify</code> to the current (and only) image. The return
|
212
|
+
value is a new image, half the size of the original.</p>
|
213
|
+
|
214
|
+
<p>Line 6 demonstrates the Image class's <code>display</code>
|
215
|
+
method, which displays a single image on the X Window screen.
|
216
|
+
<code>Image#display</code> makes a picture of a (in this case,
|
217
|
+
small) cheetah appear on your monitor.</p>
|
218
|
+
|
219
|
+
<p>Here's how to write the small cheetah to a file in GIF
|
220
|
+
format.</p>
|
221
|
+
<pre class="example">
|
222
|
+
1. require "rmagick"
|
223
|
+
2. include Magick
|
224
|
+
3.
|
225
|
+
4. cat = ImageList.new("Cheetah.jpg")
|
226
|
+
5. smallcat = cat.minify
|
227
|
+
6. smallcat.display
|
228
|
+
7. smallcat.write("Small-Cheetah.gif")
|
229
|
+
8. exit
|
230
|
+
</pre>
|
231
|
+
|
232
|
+
<p>The statement on line 7 writes the image to a file. Notice
|
233
|
+
that the filename extension is <code>gif</code>. When writing
|
234
|
+
images, ImageMagick uses the filename extension to determine what
|
235
|
+
image format to write. In this example, the
|
236
|
+
<code>Small-Cheetah.gif</code> file will be in the GIF format.
|
237
|
+
Notice how easy it is to covert an image from one format to
|
238
|
+
another? (For more details, see <a href=
|
239
|
+
"imusage.html#formats">Image formats and filenames</a>.)</p>
|
240
|
+
|
241
|
+
<p>So why, in the previous example, did I create <code>cat</code>
|
242
|
+
as an ImageList object containing just one image, instead of
|
243
|
+
creating an Image object? No reason, really. When you only have
|
244
|
+
one image to deal with, imagelists and images are pretty much
|
245
|
+
interchangeable.</p>
|
246
|
+
|
247
|
+
<p><em><b>Note:</b></em> In most cases, an Image method does not
|
248
|
+
modify the image to which it is sent. Instead, the method returns
|
249
|
+
a new image, suitably modified. For example, the <a href=
|
250
|
+
"image3.html#resize"><code>resize</code></a> method returns a new
|
251
|
+
image, sized as specified. The receiver image is unaltered.
|
252
|
+
(Following the Ruby convention, when a method alters the receiver
|
253
|
+
object, the method name ends with "!". For example, the <a href=
|
254
|
+
"image3.html#resize_bang"><code>resize!</code></a> method resizes
|
255
|
+
the receiver in place.)</p>
|
256
|
+
|
257
|
+
<h2 id="reading">Reading, writing, and creating images</h2>
|
258
|
+
|
259
|
+
<p>You've already seen that you can create an imagelist and
|
260
|
+
initialize it by specifying the name of an image file as the
|
261
|
+
argument to <a href=
|
262
|
+
"ilist.html#new"><code>ImageList.new</code></a>. In fact,
|
263
|
+
<code>new</code> can take any number of file name arguments. If
|
264
|
+
the file contains a single image, <code>new</code> reads the
|
265
|
+
file, creates an image, and adds it to the imagelist. If the file
|
266
|
+
is a multi-frame image file, <code>new</code> adds an image for
|
267
|
+
each frame or layer in the file. Lastly, <code>new</code> changes
|
268
|
+
the scene number to point to the last image in the imagelist. In
|
269
|
+
the simple case, <code>new</code> reads a single image from a
|
270
|
+
file and sets the scene number to 0.</p>
|
271
|
+
|
272
|
+
<p>You can also create an image from scratch by calling <a href=
|
273
|
+
"image1.html#new"><code>Image.new</code></a>. This method takes 2
|
274
|
+
or 3 arguments. The first argument is the number of columns in
|
275
|
+
the new image (its width). The second argument is the number of
|
276
|
+
rows (its height). If present, the 3rd argument is a <a href=
|
277
|
+
"struct.html#fill"><code>Fill</code></a> object. To add a
|
278
|
+
"scratch" image to an imagelist, call <a href=
|
279
|
+
"ilist.html#new_image"><code>ImageList#new_image</code></a>. This
|
280
|
+
method calls <code>Image.new</code>, adds the new image to the
|
281
|
+
imagelist, and sets the scene number to point to the new image.
|
282
|
+
Scratch images are good for <a href="#drawing">drawing</a> on or
|
283
|
+
creating images by <a href=
|
284
|
+
"image1.html#composite">compositing</a>.</p>
|
285
|
+
|
286
|
+
<p>Like many other methods in the Image and ImageList classes,
|
287
|
+
<code>Image.new</code> accepts an optional block that can be used
|
288
|
+
to set additional optional parameters. If the block is present,
|
289
|
+
<code>Image.new</code> creates a <a href="info.html">parameter
|
290
|
+
object</a> and yields to the block in the scope of that object.
|
291
|
+
You set the parameters by calling attribute setter methods
|
292
|
+
defined in the parameter object's class. For example, you can set
|
293
|
+
the background color of a new image to red with the
|
294
|
+
<code>background_color=</code> method, as shown here:</p>
|
295
|
+
<pre class="example">
|
296
|
+
require "rmagick"
|
297
|
+
include Magick
|
298
|
+
# Create a 100x100 red image.
|
299
|
+
f = Image.new(100,100) { self.background_color = "red" }
|
300
|
+
f.display
|
301
|
+
exit
|
302
|
+
</pre>
|
303
|
+
|
304
|
+
<p>Within the parameter block you must use <code>self</code> so
|
305
|
+
that Ruby knows that this statement is a method call, not an
|
306
|
+
assignment to a variable.</p>
|
307
|
+
|
308
|
+
<p>You can create an image by capturing it from the XWindow
|
309
|
+
screen using <a href=
|
310
|
+
"image1.html#capture"><code>Image.capture</code></a>. This method
|
311
|
+
can capture the root window, a window identified by name or ID
|
312
|
+
number, or perform an interactive capture whereby you designate
|
313
|
+
the desired window by clicking it or by drawing a rectangle on
|
314
|
+
the screen with your mouse.</p>
|
315
|
+
|
316
|
+
<p>Both the Image class and the ImageList class have
|
317
|
+
<code>write</code> methods. Both accept a single argument, the
|
318
|
+
name of the file to be written. <a href=
|
319
|
+
"image3.html#write"><code>Image#write</code></a> simply writes
|
320
|
+
the image to a file. Like the <code>Image#read</code> method,
|
321
|
+
<code>write</code> yields to an optional block that you can use
|
322
|
+
to set parameters that control how the image is written.</p>
|
323
|
+
|
324
|
+
<p>If an ImageList object contains only one image, then <a href=
|
325
|
+
"ilist.html#write"><code>ImageList#write</code></a> is the same
|
326
|
+
as <code>Image#write</code>. However, if the imagelist contains
|
327
|
+
multiple images and the file format (determined by the file name
|
328
|
+
extension, as I mentioned earlier) supports multi-frame images,
|
329
|
+
<code>Image#write</code> will automatically create a multi-frame
|
330
|
+
image file.</p>
|
331
|
+
|
332
|
+
<p>For example, the following program reads three GIF files and
|
333
|
+
then uses <code>ImageList#write</code> to combine all the images
|
334
|
+
in those files (remember, each input file can contain multiple
|
335
|
+
images) into one animated GIF file.</p>
|
336
|
+
<pre class="example">
|
337
|
+
#!/usr/bin/env ruby -w
|
338
|
+
require "rmagick"
|
339
|
+
anim = ImageList.new("start.gif", "middle.gif", "finish.gif")
|
340
|
+
anim.write("animated.gif")
|
341
|
+
exit
|
342
|
+
</pre>
|
343
|
+
|
344
|
+
<h2 id="displaying">Displaying images</h2>
|
345
|
+
|
346
|
+
<p>RMagick defines 3 methods for displaying images and
|
347
|
+
imagelists. Both the Image class and the ImageList class have a
|
348
|
+
<code>display</code> method. The <a href=
|
349
|
+
"image1.html#display"><code>Image#display</code></a> method
|
350
|
+
displays the image on the default X Window screen. For imagelists
|
351
|
+
with just one image, <a href=
|
352
|
+
"ilist.html#display"><code>ImageList#display</code></a> is
|
353
|
+
identical to <code>Image#display</code>. However, if the
|
354
|
+
imagelist contains multiple images,
|
355
|
+
<code>ImageList#display</code> displays each of the images in
|
356
|
+
turn. With both methods, right-clicking the display window will
|
357
|
+
produce a menu of other options.</p>
|
358
|
+
|
359
|
+
<p>The <a href=
|
360
|
+
"ilist.html#animate"><code>ImageList#animate</code></a> method
|
361
|
+
repeatedly cycles through all the images in an imagelist,
|
362
|
+
displaying each one in turn. You can control the speed of the
|
363
|
+
animation with the <a href=
|
364
|
+
"ilist.html#delay_eq"><code>ImageList#delay=</code></a>
|
365
|
+
method.</p>
|
366
|
+
|
367
|
+
<h2 id="modifying">Examining and modifying images</h2>
|
368
|
+
|
369
|
+
<p>Once you've created an image or imagelist, what can you do
|
370
|
+
with it? The Image and ImageList classes define over 100 methods
|
371
|
+
for examining and modifying images, both individually and in
|
372
|
+
groups. Remember, unless the ImageList class defines a method
|
373
|
+
with the same name, you can send any method defined in the Image
|
374
|
+
class to an instance of the ImageList class. The ImageList class
|
375
|
+
sends the method to the current image and returns the result.</p>
|
376
|
+
|
377
|
+
<p>The methods can be classified into the following broad groups.
|
378
|
+
ImageList method descriptions look like <span class=
|
379
|
+
"ilist">this</span>. Some of the listed methods are not available
|
380
|
+
in some releases of ImageMagick. See the method documentation for
|
381
|
+
details.</p>
|
382
|
+
|
383
|
+
<div id="index">
|
384
|
+
<h4>Utility methods</h4>
|
385
|
+
|
386
|
+
<dl>
|
387
|
+
<dt><a href="image1.html#spaceship"><=></a></dt>
|
388
|
+
|
389
|
+
<dd>Compare 2 images</dd>
|
390
|
+
|
391
|
+
<dt class="ilist"><a href=
|
392
|
+
"ilist.html#spaceship"><=></a></dt>
|
393
|
+
|
394
|
+
<dd class="ilist">Compare 2 imagelists</dd>
|
395
|
+
|
396
|
+
<dt><a href="image1.html#aref">[ ]</a></dt>
|
397
|
+
|
398
|
+
<dd>Reference an image property</dd>
|
399
|
+
|
400
|
+
<dt><a href="image1.html#aset">[ ]=</a></dt>
|
401
|
+
|
402
|
+
<dd>Set an image property</dd>
|
403
|
+
|
404
|
+
<dt><a href="image1.html#add_profile">add_profile</a></dt>
|
405
|
+
|
406
|
+
<dd>Add an ICC, IPTC, or generic profile</dd>
|
407
|
+
|
408
|
+
<dt><a href="image1.html#changed_q">changed?</a></dt>
|
409
|
+
|
410
|
+
<dd>Has the image been changed?</dd>
|
411
|
+
|
412
|
+
<dt><a href="image1.html#channel">channel</a></dt>
|
413
|
+
|
414
|
+
<dd>Extract a color channel from the image</dd>
|
415
|
+
|
416
|
+
<dt><a href=
|
417
|
+
"image1.html#compare_channel">compare_channel</a></dt>
|
418
|
+
|
419
|
+
<dd>Compare one or more channels between two images</dd>
|
420
|
+
|
421
|
+
<dt><a href=
|
422
|
+
"image1.html#channel_depth">channel_depth</a></dt>
|
423
|
+
|
424
|
+
<dd>Return the depth of the specified channel or
|
425
|
+
channels</dd>
|
426
|
+
|
427
|
+
<dt><a href=
|
428
|
+
"image1.html#channel_extrema">channel_extrema</a></dt>
|
429
|
+
|
430
|
+
<dd>Return the maximum and minimum intensity values for one
|
431
|
+
or more channels in the image</dd>
|
432
|
+
|
433
|
+
<dt><a href=
|
434
|
+
"image1.html#check_destroyed">check_destroyed</a></dt>
|
435
|
+
|
436
|
+
<dd>Raise an exception if the image has been destroyed</dd>
|
437
|
+
|
438
|
+
<dt><a href="image1.html#clone">clone</a></dt>
|
439
|
+
|
440
|
+
<dd>Return a shallow copy of the image</dd>
|
441
|
+
|
442
|
+
<dt class="ilist"><a href="ilist.html#clone">clone</a></dt>
|
443
|
+
|
444
|
+
<dd class="ilist">Return a shallow copy of the imagelist</dd>
|
445
|
+
|
446
|
+
<dt><a href=
|
447
|
+
"image1.html#color_histogram">color_histogram</a></dt>
|
448
|
+
|
449
|
+
<dd>Count the number of times each unique color appears in
|
450
|
+
the image</dd>
|
451
|
+
|
452
|
+
<dt><a href="image1.html#combine">combine</a></dt>
|
453
|
+
|
454
|
+
<dd>Combines the grayscale value of the pixels in each image
|
455
|
+
to form a new image.</dd>
|
456
|
+
|
457
|
+
<dt><a href="image1.html#copy">copy</a></dt>
|
458
|
+
|
459
|
+
<dd>Return a deep copy of the image</dd>
|
460
|
+
|
461
|
+
<dt class="ilist"><a href="ilist.html#copy">copy</a></dt>
|
462
|
+
|
463
|
+
<dd class="ilist">Return a deep copy of the imagelist</dd>
|
464
|
+
|
465
|
+
<dt><a href=
|
466
|
+
"image1.html#delete_profile">delete_profile</a></dt>
|
467
|
+
|
468
|
+
<dd>Delete an ICC, IPTC, or generic profile</dd>
|
469
|
+
|
470
|
+
<dt><a href="image1.html#destroy_bang">destroy!</a></dt>
|
471
|
+
|
472
|
+
<dd>Return all memory associated with the image to the
|
473
|
+
system</dd>
|
474
|
+
|
475
|
+
<dt><a href="image1.html#destroyed_q">destroyed?</a></dt>
|
476
|
+
|
477
|
+
<dd>Has the image has been destroyed?</dd>
|
478
|
+
|
479
|
+
<dt><a href="image1.html#difference">difference</a></dt>
|
480
|
+
|
481
|
+
<dd>Compute the difference between two images</dd>
|
482
|
+
|
483
|
+
<dt><a href=
|
484
|
+
"image1.html#distortion_channel">distortion_channel</a></dt>
|
485
|
+
|
486
|
+
<dd>Compare one or more channels to a reconstructed
|
487
|
+
image</dd>
|
488
|
+
|
489
|
+
<dt><a href="image1.html#dup">dup</a></dt>
|
490
|
+
|
491
|
+
<dd>Return a shallow copy of the image</dd>
|
492
|
+
|
493
|
+
<dt class="ilist"><a href="ilist.html#dup">dup</a></dt>
|
494
|
+
|
495
|
+
<dd class="ilist">Return a shallow copy of the imagelist</dd>
|
496
|
+
|
497
|
+
<dt><a href="image2.html#each_pixel">each_pixel</a></dt>
|
498
|
+
|
499
|
+
<dd>Iterate over all the pixels in the image</dd>
|
500
|
+
|
501
|
+
<dt><a href="image2.html#each_profile">each_profile</a></dt>
|
502
|
+
|
503
|
+
<dd>Iterate over all the profiles associated with the
|
504
|
+
image</dd>
|
505
|
+
|
506
|
+
<dt><a href=
|
507
|
+
"image2.html#export_pixels">export_pixels</a></dt>
|
508
|
+
|
509
|
+
<dd>Extract pixel data from the image into an array</dd>
|
510
|
+
|
511
|
+
<dt><a href=
|
512
|
+
"image2.html#export_pixels_to_str">export_pixels_to_str</a></dt>
|
513
|
+
|
514
|
+
<dd>Extract pixel data from the image into a string</dd>
|
515
|
+
|
516
|
+
<dt><a href=
|
517
|
+
"image2.html#find_similar_region">find_similar_region</a></dt>
|
518
|
+
|
519
|
+
<dd>Search for a rectangle matching the target</dd>
|
520
|
+
|
521
|
+
<dt><a href=
|
522
|
+
"image2.html#get_exif_by_entry">get_exif_by_entry</a>,
|
523
|
+
<a href=
|
524
|
+
"image2.html#get_exif_by_number">get_exif_by_number</a></dt>
|
525
|
+
|
526
|
+
<dd>Get one or more EXIF property values for the image</dd>
|
527
|
+
|
528
|
+
<dt><a href="image2.html#get_pixels">get_pixels</a></dt>
|
529
|
+
|
530
|
+
<dd>Copy a region of pixels from the image</dd>
|
531
|
+
|
532
|
+
<dt><a href="image2.html#gray_q">gray?</a></dt>
|
533
|
+
|
534
|
+
<dd>Are all the pixels in the image gray?</dd>
|
535
|
+
|
536
|
+
<dt><a href="image2.html#histogram_q">histogram?</a></dt>
|
537
|
+
|
538
|
+
<dd>Does the image have <= 1024 unique colors??</dd>
|
539
|
+
|
540
|
+
<dt><a href=
|
541
|
+
"image2.html#import_pixels">import_pixels</a></dt>
|
542
|
+
|
543
|
+
<dd>Replace pixels in the image with pixel data from an
|
544
|
+
array</dd>
|
545
|
+
|
546
|
+
<dt><a href="image2.html#monochrome_q">monochrome?</a></dt>
|
547
|
+
|
548
|
+
<dd>Are all the pixels in the image either black or
|
549
|
+
white?</dd>
|
550
|
+
|
551
|
+
<dt><a href="image2.html#opaque_q">opaque?</a></dt>
|
552
|
+
|
553
|
+
<dd>Are all the pixels in the image opaque?</dd>
|
554
|
+
|
555
|
+
<dt><a href="image3.html#palette_q">palette?</a></dt>
|
556
|
+
|
557
|
+
<dd>Is the image a PseudoClass type image with 256 colors or
|
558
|
+
less?</dd>
|
559
|
+
|
560
|
+
<dt><a href="image3.html#preview">preview</a></dt>
|
561
|
+
|
562
|
+
<dd>Show the effect of a transformation method on the
|
563
|
+
image</dd>
|
564
|
+
|
565
|
+
<dt><a href="image3.html#profile_bang">profile!</a></dt>
|
566
|
+
|
567
|
+
<dd>Add or remove an ICM, IPTC, or generic profile from the
|
568
|
+
image</dd>
|
569
|
+
|
570
|
+
<dt><a href="image3.html#properties">properties</a></dt>
|
571
|
+
|
572
|
+
<dd>Iterate over all the properties associated with the
|
573
|
+
image</dd>
|
574
|
+
|
575
|
+
<dt><a href="image3.html#separate">separate</a></dt>
|
576
|
+
|
577
|
+
<dd>Construct a grayscale image for each channel
|
578
|
+
specified</dd>
|
579
|
+
|
580
|
+
<dt><a href=
|
581
|
+
"image3.html#set_channel_depth">set_channel_depth</a></dt>
|
582
|
+
|
583
|
+
<dd>Set the specified channel's depth</dd>
|
584
|
+
|
585
|
+
<dt><a href="image3.html#signature">signature</a></dt>
|
586
|
+
|
587
|
+
<dd>Compute the 64-byte message signature for the image</dd>
|
588
|
+
|
589
|
+
<dt><a href="image3.html#store_pixels">store_pixels</a></dt>
|
590
|
+
|
591
|
+
<dd>Replace a region of pixels in the image</dd>
|
592
|
+
|
593
|
+
<dt><a href="image3.html#strip_bang">strip!</a></dt>
|
594
|
+
|
595
|
+
<dd>Strip the image of all comments and profiles</dd>
|
596
|
+
|
597
|
+
<dt><a href=
|
598
|
+
"image3.html#sync_profiles">sync_profiles</a></dt>
|
599
|
+
|
600
|
+
<dd>Synchronize the image properties with the image
|
601
|
+
profiles</dd>
|
602
|
+
|
603
|
+
<dt><a href=
|
604
|
+
"image3.html#unique_colors">unique_colors</a></dt>
|
605
|
+
|
606
|
+
<dd>Construct an image from the unique colors</dd>
|
607
|
+
|
608
|
+
<dt><a href="image3.html#view">view</a></dt>
|
609
|
+
|
610
|
+
<dd>Access pixels by their coordinates.</dd>
|
611
|
+
</dl>
|
612
|
+
|
613
|
+
<h4>Reduce the number of colors</h4>
|
614
|
+
|
615
|
+
<dl>
|
616
|
+
<dt><a href=
|
617
|
+
"image1.html#compress_colormap_bang">compress_colormap!</a></dt>
|
618
|
+
|
619
|
+
<dd>Remove duplicate or unused entries in the image's
|
620
|
+
colormap</dd>
|
621
|
+
|
622
|
+
<dt><a href=
|
623
|
+
"image2.html#ordered_dither">ordered_dither</a></dt>
|
624
|
+
|
625
|
+
<dd>Dither the image to a predefined pattern</dd>
|
626
|
+
|
627
|
+
<dt><a href="image3.html#posterize">posterize</a></dt>
|
628
|
+
|
629
|
+
<dd>Reduce the number of colors for a "poster" effect</dd>
|
630
|
+
|
631
|
+
<dt><a href="image3.html#quantize">quantize</a></dt>
|
632
|
+
|
633
|
+
<dd>Choose a fixed number of colors to represent the
|
634
|
+
image</dd>
|
635
|
+
|
636
|
+
<dt class="ilist"><a href=
|
637
|
+
"ilist.html#quantize">quantize</a></dt>
|
638
|
+
|
639
|
+
<dd class="ilist">Choose a fixed number of colors to
|
640
|
+
represent all the images in the imagelist</dd>
|
641
|
+
|
642
|
+
<dt><a href="image3.html#remap">remap</a></dt>
|
643
|
+
|
644
|
+
<dd>Change the colors in the image to the colors in a
|
645
|
+
reference image.</dd>
|
646
|
+
|
647
|
+
<dt class="ilist"><a href="ilist.html#remap">remap</a></dt>
|
648
|
+
|
649
|
+
<dd class="ilist">Change the images in the imagelist to use a
|
650
|
+
common color map.</dd>
|
651
|
+
</dl>
|
652
|
+
|
653
|
+
<h4>Resize</h4>
|
654
|
+
|
655
|
+
<dl>
|
656
|
+
<dt><a href=
|
657
|
+
"image1.html#change_geometry">change_geometry</a></dt>
|
658
|
+
|
659
|
+
<dd>Compute a new constrained size for the image</dd>
|
660
|
+
|
661
|
+
<dt><a href=
|
662
|
+
"image2.html#liquid_rescale">liquid_rescale</a></dt>
|
663
|
+
|
664
|
+
<dd>Rescale image with seam-carving</dd>
|
665
|
+
|
666
|
+
<dt><a href="image2.html#magnify">magnify</a></dt>
|
667
|
+
|
668
|
+
<dd>Double the size of the image</dd>
|
669
|
+
|
670
|
+
<dt><a href="image2.html#minify">minify</a></dt>
|
671
|
+
|
672
|
+
<dd>Halve the size of the image</dd>
|
673
|
+
|
674
|
+
<dt><a href="image3.html#resample">resample</a></dt>
|
675
|
+
|
676
|
+
<dd>Resample the image to the specified horizontal and
|
677
|
+
vertical resolution</dd>
|
678
|
+
|
679
|
+
<dt><a href="image3.html#resize">resize</a></dt>
|
680
|
+
|
681
|
+
<dd>Resize the image using a filter</dd>
|
682
|
+
|
683
|
+
<dt><a href=
|
684
|
+
"image1.html#resize_to_fill">resize_to_fill</a></dt>
|
685
|
+
|
686
|
+
<dd>Resize and crop while retaining the aspect ratio</dd>
|
687
|
+
|
688
|
+
<dt><a href=
|
689
|
+
"image3.html#resize_to_fit">resize_to_fit</a></dt>
|
690
|
+
|
691
|
+
<dd>Resize the image retaining the aspect ratio</dd>
|
692
|
+
|
693
|
+
<dt><a href="image3.html#sample">sample</a></dt>
|
694
|
+
|
695
|
+
<dd>Resize the image using pixel sampling</dd>
|
696
|
+
|
697
|
+
<dt><a href="image3.html#scale">scale</a></dt>
|
698
|
+
|
699
|
+
<dd>Resize the image</dd>
|
700
|
+
|
701
|
+
<dt><a href="image3.html#thumbnail">thumbnail</a></dt>
|
702
|
+
|
703
|
+
<dd>Quickly create a thumbnail of the image</dd>
|
704
|
+
</dl>
|
705
|
+
|
706
|
+
<h4>Change colors or opacity</h4>
|
707
|
+
|
708
|
+
<dl>
|
709
|
+
<dt><a href=
|
710
|
+
"image1.html#color_fill_to_border">color_fill_to_border</a></dt>
|
711
|
+
|
712
|
+
<dd>Change the color of neighboring pixels. Stop at the
|
713
|
+
image's border color.</dd>
|
714
|
+
|
715
|
+
<dt><a href=
|
716
|
+
"image1.html#color_floodfill">color_floodfill</a></dt>
|
717
|
+
|
718
|
+
<dd>Change the color of neighboring pixels that are the same
|
719
|
+
color</dd>
|
720
|
+
|
721
|
+
<dt><a href="image1.html#colormap">colormap</a></dt>
|
722
|
+
|
723
|
+
<dd>Get or set a color in the image's colormap</dd>
|
724
|
+
|
725
|
+
<dt><a href="image1.html#color_point">color_point</a></dt>
|
726
|
+
|
727
|
+
<dd>Change the color of a single pixel in the image</dd>
|
728
|
+
|
729
|
+
<dt><a href=
|
730
|
+
"image1.html#color_reset_bang">color_reset!</a></dt>
|
731
|
+
|
732
|
+
<dd>Set the entire image to a single color</dd>
|
733
|
+
|
734
|
+
<dt><a href=
|
735
|
+
"image1.html#cycle_colormap">cycle_colormap</a></dt>
|
736
|
+
|
737
|
+
<dd>Displace the image's colormap</dd>
|
738
|
+
|
739
|
+
<dt><a href="image2.html#erase_bang">erase!</a></dt>
|
740
|
+
|
741
|
+
<dd>Set the entire image to a single color</dd>
|
742
|
+
|
743
|
+
<dt><a href=
|
744
|
+
"image2.html#matte_fill_to_border">matte_fill_to_border</a></dt>
|
745
|
+
|
746
|
+
<dd>Make transparent neighboring pixels. Stop at the image's
|
747
|
+
border color.</dd>
|
748
|
+
|
749
|
+
<dt><a href=
|
750
|
+
"image2.html#matte_floodfill">matte_floodfill</a></dt>
|
751
|
+
|
752
|
+
<dd>Make transparent neighboring pixels that are the same
|
753
|
+
color</dd>
|
754
|
+
|
755
|
+
<dt><a href="image2.html#matte_point">matte_point</a></dt>
|
756
|
+
|
757
|
+
<dd>Make a single pixel transparent</dd>
|
758
|
+
|
759
|
+
<dt><a href=
|
760
|
+
"image2.html#matte_reset_bang">matte_reset!</a></dt>
|
761
|
+
|
762
|
+
<dd>Make the entire image transparent</dd>
|
763
|
+
|
764
|
+
<dt><a href="image2.html#opaque">opaque</a>, <a href=
|
765
|
+
"image2.html#opaque_channel">opaque_channel</a></dt>
|
766
|
+
|
767
|
+
<dd>Change all pixels from the specified color to a new
|
768
|
+
color</dd>
|
769
|
+
|
770
|
+
<dt><a href="image3.html#pixel_color">pixel_color</a></dt>
|
771
|
+
|
772
|
+
<dd>Get or set the color of a single pixel</dd>
|
773
|
+
|
774
|
+
<dt><a href="image3.html#splice">splice</a></dt>
|
775
|
+
|
776
|
+
<dd>Splice a solid color into the image.</dd>
|
777
|
+
|
778
|
+
<dt><a href=
|
779
|
+
"image3.html#texture_fill_to_border">texture_fill_to_border</a></dt>
|
780
|
+
|
781
|
+
<dd>Replace neighbor pixels with pixels from a texture image.
|
782
|
+
Stop at the image's border color.</dd>
|
783
|
+
|
784
|
+
<dt><a href=
|
785
|
+
"image3.html#texture_floodfill">texture_floodfill</a></dt>
|
786
|
+
|
787
|
+
<dd>Replace neighboring pixels that are the same color with
|
788
|
+
pixels from a texture image</dd>
|
789
|
+
|
790
|
+
<dt><a href=
|
791
|
+
"image3.html#paint_transparent">paint_transparent</a>,
|
792
|
+
<a href="image3.html#transparent">transparent</a></dt>
|
793
|
+
|
794
|
+
<dd>Change the opacity value of pixels having the specified
|
795
|
+
color</dd>
|
796
|
+
|
797
|
+
<dt><a href=
|
798
|
+
"image3.html#transparent_chroma">transparent_chroma</a></dt>
|
799
|
+
|
800
|
+
<dd>Change the opacity value of pixels within the specified
|
801
|
+
range</dd>
|
802
|
+
</dl>
|
803
|
+
|
804
|
+
<h4>Rotate, flip, or shear</h4>
|
805
|
+
|
806
|
+
<dl>
|
807
|
+
<dt><a href=
|
808
|
+
"image1.html#affine_transform">affine_transform</a></dt>
|
809
|
+
|
810
|
+
<dd>Transform the image as dictated by an affine matrix</dd>
|
811
|
+
|
812
|
+
<dt><a href="image1.html#auto_orient">auto_orient</a></dt>
|
813
|
+
|
814
|
+
<dd>Rotate or flip the image using the EXIF orientation
|
815
|
+
tag</dd>
|
816
|
+
|
817
|
+
<dt><a href="image1.html#deskew">deskew</a></dt>
|
818
|
+
|
819
|
+
<dd>Straighten the image</dd>
|
820
|
+
|
821
|
+
<dt><a href="image2.html#flip">flip</a></dt>
|
822
|
+
|
823
|
+
<dd>Create a vertical mirror image</dd>
|
824
|
+
|
825
|
+
<dt><a href="image2.html#flop">flop</a></dt>
|
826
|
+
|
827
|
+
<dd>Create a horizontal mirror image</dd>
|
828
|
+
|
829
|
+
<dt><a href="image3.html#rotate">rotate</a></dt>
|
830
|
+
|
831
|
+
<dd>Rotate the image by the specified angle</dd>
|
832
|
+
|
833
|
+
<dt><a href="image3.html#shear">shear</a></dt>
|
834
|
+
|
835
|
+
<dd>Shear the image along the X or Y axis, creating a
|
836
|
+
parallelogram</dd>
|
837
|
+
|
838
|
+
<dt><a href="image3.html#transpose">transpose</a></dt>
|
839
|
+
|
840
|
+
<dd>Create a horizontal mirror image</dd>
|
841
|
+
|
842
|
+
<dt><a href="image3.html#transverse">transverse</a></dt>
|
843
|
+
|
844
|
+
<dd>Create a vertical mirror image</dd>
|
845
|
+
</dl>
|
846
|
+
|
847
|
+
<h4>Composite</h4>
|
848
|
+
|
849
|
+
<dl>
|
850
|
+
<dt><a href=
|
851
|
+
"image1.html#add_compose_mask">add_compose_mask</a></dt>
|
852
|
+
|
853
|
+
<dd>Add a mask to the background image in a composite
|
854
|
+
operation</dd>
|
855
|
+
|
856
|
+
<dt class="ilist"><a href=
|
857
|
+
"ilist.html#average">average</a></dt>
|
858
|
+
|
859
|
+
<dd class="ilist">Average all the images in the imagelist
|
860
|
+
into a single image</dd>
|
861
|
+
|
862
|
+
<dt><a href="image1.html#blend">blend</a></dt>
|
863
|
+
|
864
|
+
<dd>Blend two images together</dd>
|
865
|
+
|
866
|
+
<dt><a href="image1.html#composite">composite</a></dt>
|
867
|
+
|
868
|
+
<dd>Composite a source image onto the image</dd>
|
869
|
+
|
870
|
+
<dt><a href=
|
871
|
+
"image1.html#composite_affine">composite_affine</a></dt>
|
872
|
+
|
873
|
+
<dd>Composite a source image onto the image as dictated by an
|
874
|
+
affine matrix</dd>
|
875
|
+
|
876
|
+
<dt class="ilist"><a href=
|
877
|
+
"ilist.html#composite_layers">composite_layers</a></dt>
|
878
|
+
|
879
|
+
<dd class="ilist">Composite two imagelists</dd>
|
880
|
+
|
881
|
+
<dt><a href=
|
882
|
+
"image1.html#composite_mathematics">composite_mathematics</a></dt>
|
883
|
+
|
884
|
+
<dd>Merge a source image onto the image according to a
|
885
|
+
formula.</dd>
|
886
|
+
|
887
|
+
<dt><a href=
|
888
|
+
"image1.html#composite_tiled">composite_tiled</a></dt>
|
889
|
+
|
890
|
+
<dd>Composite multiple copies of an image over another
|
891
|
+
image</dd>
|
892
|
+
|
893
|
+
<dt><a href=
|
894
|
+
"image1.html#delete_compose_mask">delete_compose_mask</a></dt>
|
895
|
+
|
896
|
+
<dd>Delete a compose mask</dd>
|
897
|
+
|
898
|
+
<dt><a href="image1.html#displace">displace</a></dt>
|
899
|
+
|
900
|
+
<dd>Distort the image using a displacement map</dd>
|
901
|
+
|
902
|
+
<dt><a href="image1.html#dissolve">dissolve</a></dt>
|
903
|
+
|
904
|
+
<dd>Dissolve two images into each other</dd>
|
905
|
+
|
906
|
+
<dt><a href="image2.html#extent">extent</a></dt>
|
907
|
+
|
908
|
+
<dd>Extend or crop the image over the background color.</dd>
|
909
|
+
|
910
|
+
<dt><a href="image3.html#watermark">watermark</a></dt>
|
911
|
+
|
912
|
+
<dd>Composite a watermark onto the image</dd>
|
913
|
+
</dl>
|
914
|
+
|
915
|
+
<h4>Transform</h4>
|
916
|
+
|
917
|
+
<dl>
|
918
|
+
<dt class="ilist"><a href="ilist.html#append">append</a></dt>
|
919
|
+
|
920
|
+
<dd class="ilist">Append all the images in the imagelist into
|
921
|
+
a single image</dd>
|
922
|
+
|
923
|
+
<dt><a href="image1.html#chop">chop</a></dt>
|
924
|
+
|
925
|
+
<dd>Chop a region from the image</dd>
|
926
|
+
|
927
|
+
<dt class="ilist"><a href=
|
928
|
+
"ilist.html#coalesce">coalesce</a></dt>
|
929
|
+
|
930
|
+
<dd class="ilist">Merge successive images in the imagelist
|
931
|
+
into a new imagelist</dd>
|
932
|
+
|
933
|
+
<dt><a href="image1.html#crop">crop</a></dt>
|
934
|
+
|
935
|
+
<dd>Extract a region from the image</dd>
|
936
|
+
|
937
|
+
<dt><a href="image1.html#decipher">decipher</a></dt>
|
938
|
+
|
939
|
+
<dd>Convert enciphered pixels to plain pixels</dd>
|
940
|
+
|
941
|
+
<dt class="ilist"><a href=
|
942
|
+
"ilist.html#deconstruct">deconstruct</a></dt>
|
943
|
+
|
944
|
+
<dd class="ilist">Construct a new imagelist containing images
|
945
|
+
that include only the changed pixels between each image and
|
946
|
+
its successor</dd>
|
947
|
+
|
948
|
+
<dt><a href="image1.html#distort">distort</a></dt>
|
949
|
+
|
950
|
+
<dd>Distort the image</dd>
|
951
|
+
|
952
|
+
<dt><a href="image2.html#encipher">encipher</a></dt>
|
953
|
+
|
954
|
+
<dd>Encipher plain pixels</dd>
|
955
|
+
|
956
|
+
<dt><a href="image2.html#excerpt">excerpt</a></dt>
|
957
|
+
|
958
|
+
<dd>Excerpt a rectangle from the image</dd>
|
959
|
+
|
960
|
+
<dt class="ilist"><a href=
|
961
|
+
"ilist.html#flatten_images">flatten_images</a></dt>
|
962
|
+
|
963
|
+
<dd class="ilist">Merge all the images in the imagelist into
|
964
|
+
a single image</dd>
|
965
|
+
|
966
|
+
<dt class="ilist"><a href="ilist.html#mosaic">mosaic</a></dt>
|
967
|
+
|
968
|
+
<dd class="ilist">Inlay all the images in the imagelist into
|
969
|
+
a single image</dd>
|
970
|
+
|
971
|
+
<dt class="ilist"><a href=
|
972
|
+
"ilist.html#optimize_layers">optimize_layers</a></dt>
|
973
|
+
|
974
|
+
<dd class="ilist">Optimize or compare image layers</dd>
|
975
|
+
|
976
|
+
<dt><a href=
|
977
|
+
"image1.html#resize_to_fill">resize_to_fill</a></dt>
|
978
|
+
|
979
|
+
<dd>Resize and crop while retaining the aspect ratio</dd>
|
980
|
+
|
981
|
+
<dt><a href="image3.html#roll">roll</a></dt>
|
982
|
+
|
983
|
+
<dd>Offset the image</dd>
|
984
|
+
|
985
|
+
<dt><a href="image3.html#shave">shave</a></dt>
|
986
|
+
|
987
|
+
<dd>Shave regions from the edges of the image</dd>
|
988
|
+
|
989
|
+
<dt><a href="image3.html#trim">trim</a></dt>
|
990
|
+
|
991
|
+
<dd>Remove borders from the edges of the image</dd>
|
992
|
+
</dl>
|
993
|
+
|
994
|
+
<h4>Enhance</h4>
|
995
|
+
|
996
|
+
<dl>
|
997
|
+
<dt><a href="image1.html#clut_channel">clut_channel</a></dt>
|
998
|
+
|
999
|
+
<dd>Replace the channel values in the image with a lookup of
|
1000
|
+
its replacement value in an LUT gradient image.</dd>
|
1001
|
+
|
1002
|
+
<dt><a href="image1.html#contrast">contrast</a></dt>
|
1003
|
+
|
1004
|
+
<dd>Enhance the intensity differences between the lighter and
|
1005
|
+
darker elements in the image</dd>
|
1006
|
+
|
1007
|
+
<dt><a href=
|
1008
|
+
"image1.html#contrast_stretch_channel">contrast_stretch_channel</a></dt>
|
1009
|
+
|
1010
|
+
<dd>Improve the contrast in the image by stretching the range
|
1011
|
+
of intensity values</dd>
|
1012
|
+
|
1013
|
+
<dt><a href="image1.html#despeckle">despeckle</a></dt>
|
1014
|
+
|
1015
|
+
<dd>Reduce the speckle noise in the image</dd>
|
1016
|
+
|
1017
|
+
<dt><a href="image2.html#enhance">enhance</a></dt>
|
1018
|
+
|
1019
|
+
<dd>Apply a digital filter that improves the quality of a
|
1020
|
+
noisy image</dd>
|
1021
|
+
|
1022
|
+
<dt><a href="image2.html#equalize">equalize</a>, <a href=
|
1023
|
+
"image2.html#equalize_channel">equalize_channel</a></dt>
|
1024
|
+
|
1025
|
+
<dd>Apply a histogram equalization to the image</dd>
|
1026
|
+
|
1027
|
+
<dt><a href=
|
1028
|
+
"image2.html#function_channel">function_channel</a></dt>
|
1029
|
+
|
1030
|
+
<dd>Apply a function to selected channel values</dd>
|
1031
|
+
|
1032
|
+
<dt class="ilist"><a href="ilist.html#fx">fx</a></dt>
|
1033
|
+
|
1034
|
+
<dd class="ilist">Apply a mathematical expression to an
|
1035
|
+
image</dd>
|
1036
|
+
|
1037
|
+
<dt><a href=
|
1038
|
+
"image1.html#auto_gamma_channel">auto_gamma_channel</a>,
|
1039
|
+
<a href="image2.html#gamma_correct">gamma_correct</a>,
|
1040
|
+
<a href="image2.html#gamma_channel">gamma_channel</a></dt>
|
1041
|
+
|
1042
|
+
<dd>Gamma correct the image</dd>
|
1043
|
+
|
1044
|
+
<dt><a href=
|
1045
|
+
"image1.html#auto_level_channel">auto_level_channel</a>,
|
1046
|
+
<a href="image2.html#level">level,</a> <a href=
|
1047
|
+
"image2.html#level_channel">level_channel</a>, <a href=
|
1048
|
+
"image2.html#level_colors">level_colors</a>, <a href=
|
1049
|
+
"image2.html#levelize_channel">levelize_channel</a></dt>
|
1050
|
+
|
1051
|
+
<dd>Adjust the levels of one or more channels in the
|
1052
|
+
image</dd>
|
1053
|
+
|
1054
|
+
<dt><a href=
|
1055
|
+
"image2.html#linear_stretch">linear_stretch</a></dt>
|
1056
|
+
|
1057
|
+
<dd>Stretch with saturation the image contrast</dd>
|
1058
|
+
|
1059
|
+
<dt><a href=
|
1060
|
+
"image2.html#median_filter">median_filter</a></dt>
|
1061
|
+
|
1062
|
+
<dd>Apply a digital filter that improves the quality of a
|
1063
|
+
noisy image</dd>
|
1064
|
+
|
1065
|
+
<dt><a href="image2.html#modulate">modulate</a></dt>
|
1066
|
+
|
1067
|
+
<dd>Change the brightness, saturation, or hue of the
|
1068
|
+
image</dd>
|
1069
|
+
|
1070
|
+
<dt><a href="image2.html#negate">negate</a>, <a href=
|
1071
|
+
"image2.html#negate_channel">negate_channel</a></dt>
|
1072
|
+
|
1073
|
+
<dd>Negate the colors of the image</dd>
|
1074
|
+
|
1075
|
+
<dt><a href="image2.html#normalize">normalize</a>, <a href=
|
1076
|
+
"image2.html#normalize_channel">normalize_channel</a></dt>
|
1077
|
+
|
1078
|
+
<dd>Enhance the contrast of the image</dd>
|
1079
|
+
|
1080
|
+
<dt><a href=
|
1081
|
+
"image3.html#quantum_operator">quantum_operator</a></dt>
|
1082
|
+
|
1083
|
+
<dd>Performs an integer arithmetic operation on selected
|
1084
|
+
channels values</dd>
|
1085
|
+
|
1086
|
+
<dt><a href="image3.html#reduce_noise">reduce_noise</a></dt>
|
1087
|
+
|
1088
|
+
<dd>Smooth the contours of an image while still preserving
|
1089
|
+
edge information</dd>
|
1090
|
+
|
1091
|
+
<dt><a href=
|
1092
|
+
"image1.html#adaptive_sharpen">adaptive_sharpen</a>, <a href=
|
1093
|
+
"image1.html#adaptive_sharpen_channel">adaptive_sharpen_channel</a>,
|
1094
|
+
<a href="image3.html#sharpen">sharpen</a>, <a href=
|
1095
|
+
"image3.html#sharpen_channel">sharpen_channel</a>, <a href=
|
1096
|
+
"image3.html#unsharp_mask">unsharp_mask</a>, <a href=
|
1097
|
+
"image3.html#unsharp_mask_channel">unsharp_mask_channel</a></dt>
|
1098
|
+
|
1099
|
+
<dd>Sharpen the image</dd>
|
1100
|
+
|
1101
|
+
<dt><a href=
|
1102
|
+
"image3.html#sigmoidal_contrast_channel">sigmoidal_contrast_channel</a></dt>
|
1103
|
+
|
1104
|
+
<dd>Adjusts the contrast of an image channel with a
|
1105
|
+
non-linear sigmoidal contrast algorithm</dd>
|
1106
|
+
</dl>
|
1107
|
+
|
1108
|
+
<h4>Add effects</h4>
|
1109
|
+
|
1110
|
+
<dl>
|
1111
|
+
<dt><a href=
|
1112
|
+
"image1.html#adaptive_threshold">adaptive_threshold</a></dt>
|
1113
|
+
|
1114
|
+
<dd>Threshold an image whose global intensity histogram
|
1115
|
+
doesn't contain distinctive peaks</dd>
|
1116
|
+
|
1117
|
+
<dt><a href="image1.html#add_noise">add_noise</a>, <a href=
|
1118
|
+
"image1.html#add_noise_channel">add_noise_channel</a></dt>
|
1119
|
+
|
1120
|
+
<dd>Add random noise</dd>
|
1121
|
+
|
1122
|
+
<dt><a href=
|
1123
|
+
"image1.html#bilevel_channel">bilevel_channel</a></dt>
|
1124
|
+
|
1125
|
+
<dd class="imquote">Change the value of individual image
|
1126
|
+
pixels based on the intensity of each pixel channel</dd>
|
1127
|
+
|
1128
|
+
<dt><a href=
|
1129
|
+
"image1.html#black_threshold">black_threshold</a></dt>
|
1130
|
+
|
1131
|
+
<dd>Force all pixels below the threshold into black</dd>
|
1132
|
+
|
1133
|
+
<dt><a href="image1.html#blue_shift">blue_shift</a></dt>
|
1134
|
+
|
1135
|
+
<dd class="imquote">Simulate a scene at nighttime in the
|
1136
|
+
moonlight</dd>
|
1137
|
+
|
1138
|
+
<dt><a href="image1.html#adaptive_blur">adaptive_blur</a>,
|
1139
|
+
<a href=
|
1140
|
+
"image1.html#adaptive_blur_channel">adaptive_blur_channel</a>,
|
1141
|
+
<a href="image1.html#blur_image">blur_image</a>, <a href=
|
1142
|
+
"image1.html#blur_channel">blur_channel</a>, <a href=
|
1143
|
+
"image2.html#gaussian_blur">gaussian_blur</a>, <a href=
|
1144
|
+
"image2.html#gaussian_blur_channel">gaussian_blur_channel</a>,
|
1145
|
+
<a href="image2.html#motion_blur">motion_blur</a>, <a href=
|
1146
|
+
"image3.html#radial_blur">radial_blur</a>, <a href=
|
1147
|
+
"image3.html#radial_blur_channel">radial_blur_channel</a>,
|
1148
|
+
<a href=
|
1149
|
+
"image3.html#selective_blur_channel">selective_blur_channel</a></dt>
|
1150
|
+
|
1151
|
+
<dd>Blur the image</dd>
|
1152
|
+
|
1153
|
+
<dt><a href="image1.html#colorize">colorize</a></dt>
|
1154
|
+
|
1155
|
+
<dd>Blend the fill color with each pixel in the image</dd>
|
1156
|
+
|
1157
|
+
<dt><a href="image1.html#convolve">convolve</a>, <a href=
|
1158
|
+
"image1.html#convolve_channel">convolve_channel</a></dt>
|
1159
|
+
|
1160
|
+
<dd>Apply a custom convolution kernel to the image</dd>
|
1161
|
+
|
1162
|
+
<dt><a href="image3.html#segment">segment</a></dt>
|
1163
|
+
|
1164
|
+
<dd>Segment an image by analyzing the histograms of the color
|
1165
|
+
components and identifying units that are homogeneous with
|
1166
|
+
the fuzzy c-means technique</dd>
|
1167
|
+
|
1168
|
+
<dt><a href=
|
1169
|
+
"image3.html#random_threshold_channel">random_threshold_channel</a></dt>
|
1170
|
+
|
1171
|
+
<dd>Change the value of individual pixels based on the
|
1172
|
+
intensity of each pixel compared to a random threshold.</dd>
|
1173
|
+
|
1174
|
+
<dt><a href="image3.html#recolor">recolor</a></dt>
|
1175
|
+
|
1176
|
+
<dd>translate, scale, shear, or rotate the image colors</dd>
|
1177
|
+
|
1178
|
+
<dt><a href="image3.html#threshold">threshold</a></dt>
|
1179
|
+
|
1180
|
+
<dd>Change the value of individual pixels based on the
|
1181
|
+
intensity of each pixel compared to threshold</dd>
|
1182
|
+
|
1183
|
+
<dt><a href=
|
1184
|
+
"image3.html#white_threshold">white_threshold</a></dt>
|
1185
|
+
|
1186
|
+
<dd>Force all pixels above the threshold into white</dd>
|
1187
|
+
</dl>
|
1188
|
+
|
1189
|
+
<h4>Add special effects</h4>
|
1190
|
+
|
1191
|
+
<dl>
|
1192
|
+
<dt><a href="image1.html#charcoal">charcoal</a></dt>
|
1193
|
+
|
1194
|
+
<dd>Add a charcoal effect</dd>
|
1195
|
+
|
1196
|
+
<dt><a href="image2.html#edge">edge</a></dt>
|
1197
|
+
|
1198
|
+
<dd>Find edges in the image</dd>
|
1199
|
+
|
1200
|
+
<dt><a href="image2.html#emboss">emboss</a></dt>
|
1201
|
+
|
1202
|
+
<dd>Add a three-dimensional effect</dd>
|
1203
|
+
|
1204
|
+
<dt><a href="image2.html#implode">implode</a></dt>
|
1205
|
+
|
1206
|
+
<dd>Implode or explode the center pixels in the image</dd>
|
1207
|
+
|
1208
|
+
<dt class="ilist"><a href="ilist.html#morph">morph</a></dt>
|
1209
|
+
|
1210
|
+
<dd class="ilist">Transform each image in the imagelist to
|
1211
|
+
the next in sequence by creating intermediate images</dd>
|
1212
|
+
|
1213
|
+
<dt><a href="image2.html#oil_paint">oil_paint</a></dt>
|
1214
|
+
|
1215
|
+
<dd>Add an oil paint effect</dd>
|
1216
|
+
|
1217
|
+
<dt><a href="image3.html#polaroid">polaroid</a></dt>
|
1218
|
+
|
1219
|
+
<dd>Simulate a Polaroid® instant picture</dd>
|
1220
|
+
|
1221
|
+
<dt><a href="image3.html#sepiatone">sepiatone</a></dt>
|
1222
|
+
|
1223
|
+
<dd>Applies an effect similar to the effect achieved in a
|
1224
|
+
photo darkroom by sepia toning.</dd>
|
1225
|
+
|
1226
|
+
<dt><a href="image3.html#shade">shade</a></dt>
|
1227
|
+
|
1228
|
+
<dd>Shine a distant light on an image to create a
|
1229
|
+
three-dimensional effect</dd>
|
1230
|
+
|
1231
|
+
<dt><a href="image3.html#shadow">shadow</a></dt>
|
1232
|
+
|
1233
|
+
<dd>Add a shadow to an image</dd>
|
1234
|
+
|
1235
|
+
<dt><a href="image3.html#sketch">sketch</a></dt>
|
1236
|
+
|
1237
|
+
<dd>Simulate a pencil sketch</dd>
|
1238
|
+
|
1239
|
+
<dt><a href="image3.html#solarize">solarize</a></dt>
|
1240
|
+
|
1241
|
+
<dd>Apply a special effect to the image, similar to the
|
1242
|
+
effect achieved in a photo darkroom by selectively exposing
|
1243
|
+
areas of photo sensitive paper to light</dd>
|
1244
|
+
|
1245
|
+
<dt><a href="image3.html#spread">spread</a></dt>
|
1246
|
+
|
1247
|
+
<dd>Randomly displace each pixel in a block</dd>
|
1248
|
+
|
1249
|
+
<dt><a href="image3.html#stegano">stegano</a></dt>
|
1250
|
+
|
1251
|
+
<dd>Hide a digital watermark within the image</dd>
|
1252
|
+
|
1253
|
+
<dt><a href="image3.html#stereo">stereo</a></dt>
|
1254
|
+
|
1255
|
+
<dd>Combine two images into a single image that is the
|
1256
|
+
composite of a left and right image of a stereo pair</dd>
|
1257
|
+
|
1258
|
+
<dt><a href="image3.html#swirl">swirl</a></dt>
|
1259
|
+
|
1260
|
+
<dd>Swirl the pixels about the center of the image</dd>
|
1261
|
+
|
1262
|
+
<dt><a href="image3.html#vignette">vignette</a></dt>
|
1263
|
+
|
1264
|
+
<dd>Soften the edges of the image to create a vignette</dd>
|
1265
|
+
|
1266
|
+
<dt><a href="image3.html#wave">wave</a></dt>
|
1267
|
+
|
1268
|
+
<dd>Add a ripple effect to the image</dd>
|
1269
|
+
|
1270
|
+
<dt><a href="image3.html#wet_floor">wet_floor</a></dt>
|
1271
|
+
|
1272
|
+
<dd>Create a "wet floor" reflection of the image</dd>
|
1273
|
+
</dl>
|
1274
|
+
|
1275
|
+
<h4>Decorate</h4>
|
1276
|
+
|
1277
|
+
<dl>
|
1278
|
+
<dt><a href="image1.html#border">border</a></dt>
|
1279
|
+
|
1280
|
+
<dd>Surround the image with a solid-colored border</dd>
|
1281
|
+
|
1282
|
+
<dt><a href="image2.html#frame">frame</a></dt>
|
1283
|
+
|
1284
|
+
<dd>Add a simulated three-dimensional border around the
|
1285
|
+
image</dd>
|
1286
|
+
|
1287
|
+
<dt><a href="image3.html#raise">raise</a></dt>
|
1288
|
+
|
1289
|
+
<dd>Create a simulated three-dimensional button-like effect
|
1290
|
+
by lightening and darkening the edges of the image</dd>
|
1291
|
+
</dl>
|
1292
|
+
|
1293
|
+
<h4>Create thumbnail montages</h4>
|
1294
|
+
|
1295
|
+
<dl>
|
1296
|
+
<dt class="ilist"><a href=
|
1297
|
+
"ilist.html#montage">montage</a></dt>
|
1298
|
+
|
1299
|
+
<dd class="ilist">Tile image thumbnails across a canvas</dd>
|
1300
|
+
</dl>
|
1301
|
+
|
1302
|
+
<h4>Create image blobs</h4>
|
1303
|
+
|
1304
|
+
<dl>
|
1305
|
+
<dt><a href="image1.html#from_blob">from_blob</a></dt>
|
1306
|
+
|
1307
|
+
<dd>Create an image from a BLOB</dd>
|
1308
|
+
|
1309
|
+
<dt class="ilist"><a href=
|
1310
|
+
"ilist.html#from_blob">from_blob</a></dt>
|
1311
|
+
|
1312
|
+
<dd class="ilist">Create an imagelist from one or more
|
1313
|
+
BLOBs</dd>
|
1314
|
+
|
1315
|
+
<dt><a href="image3.html#to_blob">to_blob</a></dt>
|
1316
|
+
|
1317
|
+
<dd>Construct a BLOB from an image</dd>
|
1318
|
+
|
1319
|
+
<dt class="ilist"><a href=
|
1320
|
+
"ilist.html#to_blob">to_blob</a></dt>
|
1321
|
+
|
1322
|
+
<dd class="ilist">Construct a BLOB from all the images in the
|
1323
|
+
imagelist</dd>
|
1324
|
+
</dl>
|
1325
|
+
</div>
|
1326
|
+
|
1327
|
+
<h2 id="marshaling">Marshaling images</h2>
|
1328
|
+
|
1329
|
+
<p>ImageList, Image, Draw, and Pixel objects are marshaled using
|
1330
|
+
custom serialization methods. Images are marshaled with
|
1331
|
+
ImageMagick's Binary Large OBject functions
|
1332
|
+
<code>ImageToBlob</code> (for dumping) and
|
1333
|
+
<code>BlobToImage</code> (for loading).</p>
|
1334
|
+
|
1335
|
+
<h4>Notes</h4>
|
1336
|
+
|
1337
|
+
<ol>
|
1338
|
+
<li>Some image formats cannot be dumped. The only way to be
|
1339
|
+
sure it will work is to try it.</li>
|
1340
|
+
|
1341
|
+
<li>Images in lossy formats, such as JPEG, will have a
|
1342
|
+
different signature after being reconstituted and therefore
|
1343
|
+
will not compare equal (using <a href=
|
1344
|
+
"image1.html#spaceship"><=></a>) to the original
|
1345
|
+
image.</li>
|
1346
|
+
|
1347
|
+
<li>Image metadata may be changed by marshaling.</li>
|
1348
|
+
</ol>
|
1349
|
+
|
1350
|
+
<h2 id="drawing_on">Drawing on and adding text to images</h2>
|
1351
|
+
|
1352
|
+
<p>The <strong>Draw</strong> class is the third major class in
|
1353
|
+
the Magick module. This class defines two kinds of methods,
|
1354
|
+
<a href="#drawing">drawing</a> methods and <a href=
|
1355
|
+
"#annotation">annotation</a> methods.</p>
|
1356
|
+
|
1357
|
+
<h3 id="drawing">Drawing</h3>
|
1358
|
+
|
1359
|
+
<p>ImageMagick supports a set of 2D drawing commands that are
|
1360
|
+
very similar to the commands and elements defined by the W3C's
|
1361
|
+
<a href="http://www.w3.org/TR/SVG/index.html#minitoc">Scalable
|
1362
|
+
Vector Graphics (SVG) 1.1 Specification</a>. In RMagick, each
|
1363
|
+
command (called a <em>primitive</em>) is implemented as a method
|
1364
|
+
in the <code>Draw</code> class. To draw on an image, simply</p>
|
1365
|
+
|
1366
|
+
<ol>
|
1367
|
+
<li>Create an instance of the <code>Draw</code> class.</li>
|
1368
|
+
|
1369
|
+
<li>Call one or more primitive methods with the appropriate
|
1370
|
+
arguments.</li>
|
1371
|
+
|
1372
|
+
<li>Call the <a href="draw.html#draw"><code>draw</code></a>
|
1373
|
+
method.</li>
|
1374
|
+
</ol>
|
1375
|
+
|
1376
|
+
<p>The primitive methods do <em>not</em> draw anything directly.
|
1377
|
+
When you call a primitive method, you are simply adding the
|
1378
|
+
primitive and its arguments to a list of primitives stored in the
|
1379
|
+
<code>Draw</code> object. To "execute" the primitive list, call
|
1380
|
+
<code>draw</code>. Drawing the primitives does not destroy them.
|
1381
|
+
You can draw on another image by calling <code>draw</code> again,
|
1382
|
+
specifying a different image as the "canvas." Of course you can
|
1383
|
+
also draw on an image with multiple <code>Draw</code> objects,
|
1384
|
+
too. The canvas can be any image or imagelist, created by reading
|
1385
|
+
an image file or from scratch using
|
1386
|
+
<code>ImageList#new_image</code> or <code>Image.new</code>. (If
|
1387
|
+
you pass an imagelist object to <code>draw</code>, it draws on
|
1388
|
+
the current image.)</p>
|
1389
|
+
|
1390
|
+
<div id="axes">
|
1391
|
+
<a href="javascript:popup('axes.rb.html')"><img src=
|
1392
|
+
"ex/axes.gif" alt="Drawing coordinate system" title=
|
1393
|
+
"Click to see the example script" /></a>
|
1394
|
+
|
1395
|
+
<div>
|
1396
|
+
<p>Here's an illustration of the default drawing coordinate
|
1397
|
+
system. The origin is in the top left corner. The x axis
|
1398
|
+
extends to the right. The y axis extends downward. The units
|
1399
|
+
are pixels. 0° is at 3 o'clock and rotation is clockwise.
|
1400
|
+
The units of rotation are usually degrees.<sup><a href=
|
1401
|
+
"#degrees">3</a></sup></p>
|
1402
|
+
|
1403
|
+
<p>You can change the default coordinate system by specifying
|
1404
|
+
a <em>scaling</em>, <em>rotation</em>, or
|
1405
|
+
<em>translation</em> transformation.</p>
|
1406
|
+
|
1407
|
+
<p><em>(Click the image to see the Ruby program that created
|
1408
|
+
it.)</em></p>
|
1409
|
+
</div>
|
1410
|
+
</div>
|
1411
|
+
|
1412
|
+
<p>RMagick's primitive methods include methods for drawing
|
1413
|
+
points, lines, Bezier curves, shapes such as ellipses and
|
1414
|
+
rectangles, and text. Shapes and lines have a fill color and a
|
1415
|
+
stroke color. Shapes are filled with the fill color unless the
|
1416
|
+
fill opacity is 0. Similarly, shapes are stroked with the stroke
|
1417
|
+
color unless the stroke opacity is 0. Text is considered a shape
|
1418
|
+
and is stroked and filled. Other rendering properties you can set
|
1419
|
+
include the stroke width, antialiasing, stroke patterns, and fill
|
1420
|
+
patterns.</p>
|
1421
|
+
|
1422
|
+
<p>As an example, here's the section of the Ruby program that
|
1423
|
+
created the circle in the center of the above image.</p>
|
1424
|
+
<pre class="example">
|
1425
|
+
1. !# /usr/local/bin/ruby -w
|
1426
|
+
2. require "rmagick"
|
1427
|
+
3.
|
1428
|
+
4. canvas = Magick::ImageList.new
|
1429
|
+
5. canvas.new_image(250, 250, Magick::HatchFill.new('white', 'gray90'))
|
1430
|
+
6.
|
1431
|
+
7. circle = Magick::Draw.new
|
1432
|
+
8. circle.stroke('tomato')
|
1433
|
+
9. circle.fill_opacity(0)
|
1434
|
+
10. circle.stroke_opacity(0.75)
|
1435
|
+
11. circle.stroke_width(6)
|
1436
|
+
12. circle.stroke_linecap('round')
|
1437
|
+
13. circle.stroke_linejoin('round')
|
1438
|
+
14. circle.ellipse(canvas.rows/2,canvas.columns/2, 80, 80, 0, 315)
|
1439
|
+
15. circle.polyline(180,70, 173,78, 190,78, 191,62)
|
1440
|
+
16. circle.draw(canvas)
|
1441
|
+
</pre>
|
1442
|
+
|
1443
|
+
<p>The statements on lines 4 and 5 create the drawing canvas with
|
1444
|
+
a single 250x250 image. The <code>HatchFill</code> object fills
|
1445
|
+
the image with light-gray lines 10 pixels apart. The statement on
|
1446
|
+
line 7 creates a Draw object. The method calls on lines 8-15
|
1447
|
+
construct a list of primitives that are "executed" by the
|
1448
|
+
<code>draw</code> method call on line 16.</p>
|
1449
|
+
|
1450
|
+
<p>The <code>stroke</code> method sets the stroke color, as seen
|
1451
|
+
on line 8. Normally, shapes are filled (opacity = 1.0), but the
|
1452
|
+
call to <code>fill_opacity</code> on line 9 sets the opacity to
|
1453
|
+
0, so the background will show through the circle. Similarly, the
|
1454
|
+
stroke lines are normally opaque, but the tomato-colored stroke
|
1455
|
+
line in this example is made slightly transparent by the call to
|
1456
|
+
<code>stroke_opacity</code> on line 10. The method calls on lines
|
1457
|
+
11 through 13 set the stroke width and specify the appearance of
|
1458
|
+
the line ends and corners.</p>
|
1459
|
+
|
1460
|
+
<p>The <code>ellipse</code> method call on line 14 describes an
|
1461
|
+
circle in the center of the canvas with a radius of 80 pixels.
|
1462
|
+
The ellipse occupies 315° of a circle, starting at 0°
|
1463
|
+
(that is, 3 o'clock). The <code>polyline</code> call on line 15
|
1464
|
+
adds the arrowhead to the circle. The arguments (always an even
|
1465
|
+
number) are the x- and y-coordinates of the points the line
|
1466
|
+
passes through.</p>
|
1467
|
+
|
1468
|
+
<p>Finally, the <code>draw</code> method on line 16 identifies
|
1469
|
+
the canvas to be drawn on and executes the stored primitives.</p>
|
1470
|
+
|
1471
|
+
<h3 id="annotation">Annotation</h3>
|
1472
|
+
|
1473
|
+
<p>The <a href="draw.html#annotate"><code>annotate</code></a>
|
1474
|
+
method draws text on an image. In its simplest form,
|
1475
|
+
<code>annotate</code> requires only arguments that describe where
|
1476
|
+
to draw the text and the text string.</p>
|
1477
|
+
|
1478
|
+
<p>Most of the time, you'll want to specify text properties such
|
1479
|
+
as the font, its size, font styles such as italic, font weights
|
1480
|
+
such as bold, the fill and stroke color, etc. The Draw class
|
1481
|
+
defines <a href="draw.html">attribute writers</a> for this
|
1482
|
+
purpose. You can set the desired text properties by calling the
|
1483
|
+
attribute writers before calling <code>annotate</code>, or you
|
1484
|
+
can call them in an image block associated with the
|
1485
|
+
<code>annotate</code> call.</p>
|
1486
|
+
|
1487
|
+
<p>The following example shows how to use <code>annotate</code>
|
1488
|
+
to produce this image.</p>
|
1489
|
+
|
1490
|
+
<div id="rubyname">
|
1491
|
+
<a href="javascript:popup('rubyname.rb.html')"><img src=
|
1492
|
+
"ex/rubyname.gif" alt="annotate example" title=
|
1493
|
+
"Click to see the example script" /></a>
|
1494
|
+
</div>
|
1495
|
+
<pre class="example">
|
1496
|
+
1. #! /usr/local/bin/ruby -w
|
1497
|
+
2. require "rmagick"
|
1498
|
+
3.
|
1499
|
+
4. # Demonstrate the annotate method
|
1500
|
+
5.
|
1501
|
+
6. Text = 'RMagick'
|
1502
|
+
7.
|
1503
|
+
8. granite = Magick::ImageList.new('granite:')
|
1504
|
+
9. canvas = Magick::ImageList.new
|
1505
|
+
10. canvas.new_image(300, 100, Magick::TextureFill.new(granite))
|
1506
|
+
11.
|
1507
|
+
12. text = Magick::Draw.new
|
1508
|
+
13. text.font_family = 'helvetica'
|
1509
|
+
14. text.pointsize = 52
|
1510
|
+
15. text.gravity = Magick::CenterGravity
|
1511
|
+
16.
|
1512
|
+
17. text.annotate(canvas, 0,0,2,2, Text) {
|
1513
|
+
18. self.fill = 'gray83'
|
1514
|
+
19. }
|
1515
|
+
20.
|
1516
|
+
21. text.annotate(canvas, 0,0,-1.5,-1.5, Text) {
|
1517
|
+
22. self.fill = 'gray40'
|
1518
|
+
23. }
|
1519
|
+
24.
|
1520
|
+
25. text.annotate(canvas, 0,0,0,0, Text) {
|
1521
|
+
26. self.fill = 'darkred'
|
1522
|
+
27. }
|
1523
|
+
28.
|
1524
|
+
29. canvas.write('rubyname.gif')
|
1525
|
+
30. exit
|
1526
|
+
</pre>
|
1527
|
+
|
1528
|
+
<p>This program uses three calls to <code>annotate</code> to
|
1529
|
+
produce the "etched" appearance. All three calls have some
|
1530
|
+
parameters in common but the fill color and location are
|
1531
|
+
different.</p>
|
1532
|
+
|
1533
|
+
<p>First, the statements in lines 8-10 create the background. See
|
1534
|
+
<a href="struct.html#fill"><code>Fill classes</code></a> for
|
1535
|
+
information about the <code>TextureFill</code> class. The
|
1536
|
+
"granite:" image format is one of ImageMagick's built-in image
|
1537
|
+
formats. See <a href="imusage.html#builtin_formats">"Built-in
|
1538
|
+
image formats"</a> for more information. The statement on line 12
|
1539
|
+
creates the Draw object that does the annotation. The next 3
|
1540
|
+
lines set the values of the attributes that are common to all 3
|
1541
|
+
<code>annotate</code> calls.</p>
|
1542
|
+
|
1543
|
+
<p>The first <code>annotate</code> argument is the image on which
|
1544
|
+
the text will be drawn. Arguments 2-5, <code>width</code>,
|
1545
|
+
<code>height</code>, <code>x</code>, and <code>y</code>, describe
|
1546
|
+
a rectangle about which the text is drawn. This rectangle,
|
1547
|
+
combined with the value of <code>gravity</code>, define the
|
1548
|
+
position of the text. When the <code>gravity</code> value is
|
1549
|
+
<a href=
|
1550
|
+
"constants.html#GravityType"><code>CenterGravity</code></a> the
|
1551
|
+
values of <code>width</code> and <code>height</code> are
|
1552
|
+
unused.</p>
|
1553
|
+
|
1554
|
+
<p>The first call to <code>annotate</code>, on lines 17-19, draws
|
1555
|
+
the text 2 pixels to the right and down from the center. The
|
1556
|
+
<code>self.fill = 'gray83'</code> statement sets the text color
|
1557
|
+
to light gray. The second call to <code>annotate</code>, on lines
|
1558
|
+
21-22, draws dark gray text 1.5 pixels to the left and up from
|
1559
|
+
the center. The last call, on lines 25-27, draws the text a third
|
1560
|
+
time, in dark red, exactly in the center of the image.</p>
|
1561
|
+
|
1562
|
+
<h2 id="more">Where to go from here</h2>
|
1563
|
+
|
1564
|
+
<p>The next section, <a href="imusage.html">"ImageMagick
|
1565
|
+
Conventions,"</a> describes some conventions that you need to
|
1566
|
+
know, such as how ImageMagick determines the graphic format of an
|
1567
|
+
image file, etc. The ImageMagick (www.imagemagick.org) web site
|
1568
|
+
(from which much of the information in these pages has been
|
1569
|
+
taken) offers a lot of detail about ImageMagick. While this web
|
1570
|
+
sites doesn't describe RMagick, you can often use the
|
1571
|
+
documentation to learn more about a RMagick method by reading
|
1572
|
+
about the Magick API the method calls. (In the Reference section
|
1573
|
+
of this document, most of the method descriptions include the
|
1574
|
+
name of the Magick API that the method calls.) Check out the
|
1575
|
+
example programs. Almost every one of the methods is demonstrated
|
1576
|
+
in one of the examples.</p>
|
1577
|
+
|
1578
|
+
<p>Good luck!</p>
|
1579
|
+
|
1580
|
+
<div>
|
1581
|
+
<h5 id="footnotes">Footnotes</h5>
|
1582
|
+
|
1583
|
+
<p id="display"><span class="sup">1</span>The
|
1584
|
+
<code>display</code> and <code>animate</code> methods do not
|
1585
|
+
work on MS Windows. You will have to write the image to a file
|
1586
|
+
and view it with a separate image viewer.</p>
|
1587
|
+
|
1588
|
+
<p id="rubygems"><span class="sup">2</span>If you installed
|
1589
|
+
RMagick using <a href="http://docs.rubygems.org/">Rubygems</a>
|
1590
|
+
you must set up the RubyGems environment before using RMagick.
|
1591
|
+
You can do one of</p>
|
1592
|
+
|
1593
|
+
<ol>
|
1594
|
+
<li>add the <code>require 'rubygems'</code> statement to your
|
1595
|
+
program</li>
|
1596
|
+
|
1597
|
+
<li>use the -rubygems command line option</li>
|
1598
|
+
|
1599
|
+
<li>add <code>rubygems</code> to the RUBYOPT environment
|
1600
|
+
variable</li>
|
1601
|
+
</ol>
|
1602
|
+
|
1603
|
+
<p>See the RubyGems <a href=
|
1604
|
+
"http://docs.rubygems.org/read/chapter/3#page70">doc</a> for
|
1605
|
+
more information.</p>
|
1606
|
+
|
1607
|
+
<p id="degrees"><span class="sup">3</span>The rotation
|
1608
|
+
attributes <code>rx</code> and <code>ry</code> in the <a href=
|
1609
|
+
"struct.html#AffineMatrix"><code>AffineMatrix</code></a> class
|
1610
|
+
use radians instead of degrees.</p>
|
1611
|
+
</div>
|
1612
|
+
|
1613
|
+
<p class="spacer"></p>
|
1614
|
+
|
1615
|
+
<div class="nav">
|
1616
|
+
« <a href="index.html">Prev</a> | <a href=
|
1617
|
+
"index.html">Contents</a> | <a href="imusage.html">Next</a>
|
1618
|
+
»
|
1619
|
+
</div>
|
1620
|
+
</body>
|
1621
|
+
</html>
|