rmagick 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- data/ChangeLog +232 -0
- data/Makefile.in +28 -0
- data/README.html +404 -0
- data/README.txt +397 -0
- data/configure +8554 -0
- data/configure.ac +497 -0
- data/doc/comtasks.html +241 -0
- data/doc/constants.html +1195 -0
- data/doc/css/doc.css +299 -0
- data/doc/css/popup.css +34 -0
- data/doc/draw.html +3108 -0
- data/doc/ex/Adispatch.rb +43 -0
- data/doc/ex/Zconstitute.rb +9 -0
- data/doc/ex/adaptive_threshold.rb +19 -0
- data/doc/ex/add_noise.rb +18 -0
- data/doc/ex/affine.rb +48 -0
- data/doc/ex/affine_transform.rb +20 -0
- data/doc/ex/arc.rb +47 -0
- data/doc/ex/arcpath.rb +33 -0
- data/doc/ex/average.rb +15 -0
- data/doc/ex/axes.rb +64 -0
- data/doc/ex/bilevel_channel.rb +20 -0
- data/doc/ex/blur_image.rb +12 -0
- data/doc/ex/border.rb +10 -0
- data/doc/ex/bounding_box.rb +48 -0
- data/doc/ex/cbezier1.rb +40 -0
- data/doc/ex/cbezier2.rb +40 -0
- data/doc/ex/cbezier3.rb +40 -0
- data/doc/ex/cbezier4.rb +41 -0
- data/doc/ex/cbezier5.rb +41 -0
- data/doc/ex/cbezier6.rb +51 -0
- data/doc/ex/channel.rb +26 -0
- data/doc/ex/channel_threshold.rb +48 -0
- data/doc/ex/charcoal.rb +12 -0
- data/doc/ex/chop.rb +29 -0
- data/doc/ex/circle.rb +31 -0
- data/doc/ex/clip_path.rb +56 -0
- data/doc/ex/coalesce.rb +60 -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 +60 -0
- data/doc/ex/color_reset.rb +11 -0
- data/doc/ex/colorize.rb +16 -0
- data/doc/ex/colors.rb +65 -0
- data/doc/ex/composite.rb +135 -0
- data/doc/ex/contrast.rb +37 -0
- data/doc/ex/crop.rb +31 -0
- data/doc/ex/crop_with_gravity.rb +46 -0
- data/doc/ex/cycle_colormap.rb +21 -0
- data/doc/ex/demo.rb +324 -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 +43 -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/flatten_images.rb +38 -0
- data/doc/ex/flip.rb +11 -0
- data/doc/ex/flop.rb +11 -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 +53 -0
- data/doc/ex/get_pixels.rb +48 -0
- data/doc/ex/get_type_metrics.rb +140 -0
- data/doc/ex/gradientfill.rb +27 -0
- data/doc/ex/grav.rb +44 -0
- data/doc/ex/gravity.rb +80 -0
- data/doc/ex/hatchfill.rb +27 -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/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/Shorts.jpg +0 -0
- data/doc/ex/images/Snake.wmf +0 -0
- data/doc/ex/images/Violin.jpg +0 -0
- data/doc/ex/images/graydient230x6.gif +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 +32 -0
- data/doc/ex/level.rb +12 -0
- data/doc/ex/level_channel.rb +33 -0
- data/doc/ex/line.rb +40 -0
- data/doc/ex/map.rb +28 -0
- data/doc/ex/map_f.rb +15 -0
- data/doc/ex/matte_fill_to_border.rb +42 -0
- data/doc/ex/matte_floodfill.rb +35 -0
- data/doc/ex/matte_replace.rb +42 -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 +26 -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 +19 -0
- data/doc/ex/normalize.rb +11 -0
- data/doc/ex/oil_paint.rb +11 -0
- data/doc/ex/opacity.rb +38 -0
- data/doc/ex/opaque.rb +14 -0
- data/doc/ex/ordered_dither.rb +11 -0
- data/doc/ex/path.rb +62 -0
- data/doc/ex/pattern1.rb +25 -0
- data/doc/ex/pattern2.rb +26 -0
- data/doc/ex/polygon.rb +24 -0
- data/doc/ex/polyline.rb +23 -0
- data/doc/ex/posterize.rb +19 -0
- data/doc/ex/preview.rb +16 -0
- data/doc/ex/qbezierpath.rb +49 -0
- data/doc/ex/quantize-m.rb +25 -0
- data/doc/ex/radial_blur.rb +19 -0
- data/doc/ex/raise.rb +11 -0
- data/doc/ex/random_channel_threshold.rb +17 -0
- data/doc/ex/random_threshold_channel.rb +18 -0
- data/doc/ex/rectangle.rb +33 -0
- data/doc/ex/reduce_noise.rb +28 -0
- data/doc/ex/roll.rb +9 -0
- data/doc/ex/rotate.rb +43 -0
- data/doc/ex/rotate_f.rb +14 -0
- data/doc/ex/roundrect.rb +32 -0
- data/doc/ex/rubyname.rb +31 -0
- data/doc/ex/segment.rb +11 -0
- data/doc/ex/shade.rb +11 -0
- data/doc/ex/shave.rb +15 -0
- data/doc/ex/shear.rb +10 -0
- data/doc/ex/skewx.rb +50 -0
- data/doc/ex/skewy.rb +45 -0
- data/doc/ex/smile.rb +124 -0
- data/doc/ex/solarize.rb +11 -0
- data/doc/ex/splice.rb +16 -0
- data/doc/ex/spread.rb +11 -0
- data/doc/ex/stegano.rb +50 -0
- data/doc/ex/stroke_dasharray.rb +41 -0
- data/doc/ex/stroke_linecap.rb +44 -0
- data/doc/ex/stroke_linejoin.rb +48 -0
- data/doc/ex/stroke_width.rb +47 -0
- data/doc/ex/swirl.rb +17 -0
- data/doc/ex/text.rb +32 -0
- data/doc/ex/text_align.rb +36 -0
- data/doc/ex/text_antialias.rb +33 -0
- data/doc/ex/text_undercolor.rb +26 -0
- data/doc/ex/texture_fill_to_border.rb +34 -0
- data/doc/ex/texture_floodfill.rb +31 -0
- data/doc/ex/texturefill.rb +25 -0
- data/doc/ex/threshold.rb +13 -0
- data/doc/ex/to_blob.rb +14 -0
- data/doc/ex/translate.rb +37 -0
- data/doc/ex/transparent.rb +38 -0
- data/doc/ex/trim.rb +25 -0
- data/doc/ex/unsharp_mask.rb +28 -0
- data/doc/ex/viewex.rb +36 -0
- data/doc/ex/wave.rb +9 -0
- data/doc/ilist.html +1592 -0
- data/doc/image1.html +3009 -0
- data/doc/image2.html +2169 -0
- data/doc/image3.html +2815 -0
- data/doc/imageattrs.html +1319 -0
- data/doc/imusage.html +403 -0
- data/doc/index.html +418 -0
- data/doc/info.html +949 -0
- data/doc/magick.html +439 -0
- data/doc/scripts/doc.js +9 -0
- data/doc/struct.html +1334 -0
- data/doc/usage.html +1318 -0
- data/examples/describe.rb +44 -0
- data/examples/histogram.rb +289 -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 +47 -0
- data/examples/thumbnail.rb +65 -0
- data/examples/vignette.rb +79 -0
- data/ext/RMagick/MANIFEST +239 -0
- data/ext/RMagick/extconf.rb.in +21 -0
- data/ext/RMagick/rmagick.h +938 -0
- data/ext/RMagick/rmagick_config.h.in +170 -0
- data/ext/RMagick/rmdraw.c +1308 -0
- data/ext/RMagick/rmfill.c +609 -0
- data/ext/RMagick/rmilist.c +685 -0
- data/ext/RMagick/rmimage.c +7980 -0
- data/ext/RMagick/rminfo.c +982 -0
- data/ext/RMagick/rmmain.c +1497 -0
- data/ext/RMagick/rmutil.c +2685 -0
- data/install.rb +1015 -0
- data/lib/RMagick.rb +1486 -0
- data/metaconfig.in +6 -0
- data/post-clean.rb +12 -0
- data/post-install.rb +36 -0
- data/post-setup.rb +245 -0
- data/rmagick.gemspec +22 -0
- data/uninstall.rb +71 -0
- metadata +286 -0
data/doc/ex/rubyname.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
|
4
|
+
# Demonstrate the annotate method
|
5
|
+
|
6
|
+
Text = 'RMagick'
|
7
|
+
|
8
|
+
granite = Magick::ImageList.new('granite:')
|
9
|
+
canvas = Magick::ImageList.new
|
10
|
+
canvas.new_image(300, 100, Magick::TextureFill.new(granite))
|
11
|
+
|
12
|
+
text = Magick::Draw.new
|
13
|
+
text.font_family = 'helvetica'
|
14
|
+
text.pointsize = 52
|
15
|
+
text.gravity = Magick::CenterGravity
|
16
|
+
|
17
|
+
text.annotate(canvas, 0,0,2,2, Text) {
|
18
|
+
self.fill = 'gray83'
|
19
|
+
}
|
20
|
+
|
21
|
+
text.annotate(canvas, 0,0,-1.5,-1.5, Text) {
|
22
|
+
self.fill = 'gray40'
|
23
|
+
}
|
24
|
+
|
25
|
+
text.annotate(canvas, 0,0,0,0, Text) {
|
26
|
+
self.fill = 'darkred'
|
27
|
+
}
|
28
|
+
|
29
|
+
#canvas.display
|
30
|
+
canvas.write('rubyname.gif')
|
31
|
+
exit
|
data/doc/ex/segment.rb
ADDED
data/doc/ex/shade.rb
ADDED
data/doc/ex/shave.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
|
4
|
+
# Demonstrate the Image#shave method
|
5
|
+
|
6
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
|
+
|
8
|
+
img = img.shave(20, 25)
|
9
|
+
|
10
|
+
# Add a border so the shaved image is the
|
11
|
+
# same size as the original image.
|
12
|
+
img.border!(20, 25, 'white')
|
13
|
+
|
14
|
+
img.write('shave.jpg')
|
15
|
+
exit
|
data/doc/ex/shear.rb
ADDED
data/doc/ex/skewx.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
|
4
|
+
imgl = Magick::ImageList.new
|
5
|
+
imgl.new_image(250, 250, Magick::HatchFill.new('white','lightcyan2'))
|
6
|
+
|
7
|
+
gc = Magick::Draw.new
|
8
|
+
|
9
|
+
# Move the origin to the center.
|
10
|
+
gc.translate(125, 125)
|
11
|
+
max_x = imgl.columns/2
|
12
|
+
max_y = imgl.rows/2 - 5
|
13
|
+
|
14
|
+
# Skew x 30 degrees
|
15
|
+
gc.skewx(30)
|
16
|
+
|
17
|
+
# Draw down-pointing arrow
|
18
|
+
gc.fill('red')
|
19
|
+
gc.stroke('red')
|
20
|
+
gc.stroke_width(3)
|
21
|
+
gc.line(0, -max_y, 0, max_y)
|
22
|
+
gc.line(0, max_y, 7, max_y-7)
|
23
|
+
gc.line(0, max_y, -7, max_y-7)
|
24
|
+
|
25
|
+
# Draw right-pointing arrow
|
26
|
+
gc.stroke('gray50')
|
27
|
+
gc.stroke_width(1)
|
28
|
+
gc.line(-max_x, 0, max_x, 0)
|
29
|
+
gc.line( max_x, 0, max_x-5, -5)
|
30
|
+
gc.line( max_x, 0, max_x-5, 5)
|
31
|
+
|
32
|
+
gc.draw(imgl)
|
33
|
+
|
34
|
+
# Add labels using "normal" skew
|
35
|
+
gc = Magick::Draw.new
|
36
|
+
gc.pointsize(14)
|
37
|
+
gc.stroke('transparent')
|
38
|
+
gc.gravity(Magick::CenterGravity)
|
39
|
+
gc.text(10, -10, "'0,0'")
|
40
|
+
gc.gravity(Magick::EastGravity)
|
41
|
+
gc.text(10, 10, "'+x'")
|
42
|
+
gc.gravity(Magick::SouthGravity)
|
43
|
+
gc.text(0, 20, "'+y'")
|
44
|
+
|
45
|
+
gc.draw(imgl)
|
46
|
+
|
47
|
+
imgl.border!(1,1, "lightcyan2")
|
48
|
+
|
49
|
+
imgl.write("skewx.gif")
|
50
|
+
|
data/doc/ex/skewy.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
|
4
|
+
imgl = Magick::ImageList.new
|
5
|
+
imgl.new_image(250, 250, Magick::HatchFill.new('white','lightcyan2'))
|
6
|
+
|
7
|
+
gc = Magick::Draw.new
|
8
|
+
|
9
|
+
# Move the origin to the center.
|
10
|
+
gc.translate(125, 125)
|
11
|
+
max_x = imgl.columns/2
|
12
|
+
max_y = imgl.rows/2
|
13
|
+
|
14
|
+
# Skew y 30 degrees
|
15
|
+
gc.skewy(30)
|
16
|
+
|
17
|
+
# Draw down-pointing arrow
|
18
|
+
gc.fill('gray50')
|
19
|
+
gc.line(0, -max_y, 0, max_y)
|
20
|
+
gc.line(0, max_y, 10, max_y-10)
|
21
|
+
gc.line(0, max_y, -10, max_y-10)
|
22
|
+
|
23
|
+
# Draw right-pointing arrow
|
24
|
+
gc.stroke('red')
|
25
|
+
gc.stroke_width(3)
|
26
|
+
gc.line(-max_x+10, 0, max_x-10, 0)
|
27
|
+
gc.line( max_x-10, 0, max_x-20, -10)
|
28
|
+
gc.line( max_x-10, 0, max_x-20, 10)
|
29
|
+
|
30
|
+
gc.draw(imgl)
|
31
|
+
|
32
|
+
# Add labels
|
33
|
+
gc = Magick::Draw.new
|
34
|
+
gc.pointsize(14)
|
35
|
+
gc.stroke('transparent')
|
36
|
+
gc.gravity(Magick::CenterGravity)
|
37
|
+
gc.text(15, 0, "'0,0'")
|
38
|
+
gc.gravity(Magick::EastGravity)
|
39
|
+
gc.text(10, 0, "'+x'")
|
40
|
+
gc.gravity(Magick::SouthGravity)
|
41
|
+
gc.text(10, 20, "'+y'")
|
42
|
+
gc.draw(imgl)
|
43
|
+
|
44
|
+
imgl.border!(1,1, 'lightcyan2')
|
45
|
+
imgl.write("skewy.gif")
|
data/doc/ex/smile.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
# RMagick version of ImageMagick's "smile.c" example program.
|
3
|
+
|
4
|
+
require 'RMagick'
|
5
|
+
|
6
|
+
SmileWidth = 48
|
7
|
+
SmileHeight = 48
|
8
|
+
SmileBits = [
|
9
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
10
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
11
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
12
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
13
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
|
14
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
15
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
16
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
17
|
+
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
18
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0,
|
93
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
94
|
+
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
95
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
96
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
97
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
98
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
99
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
100
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
101
|
+
0, 0, 0, 0 ]
|
102
|
+
|
103
|
+
i = Magick::ImageList.new # Create a new image
|
104
|
+
i.new_image(SmileWidth, SmileHeight) # Add a image
|
105
|
+
|
106
|
+
q = Array.new # Create an array of pixels one
|
107
|
+
SmileWidth.times do # row long
|
108
|
+
q << Magick::Pixel.new(0,0,0,0)
|
109
|
+
end
|
110
|
+
|
111
|
+
SmileHeight.times do |y| # Store pixels a row at a time
|
112
|
+
SmileWidth.times do |x| # Build a row of pixels
|
113
|
+
q[x].red = Magick::MaxRGB * SmileBits.first
|
114
|
+
q[x].green = Magick::MaxRGB * SmileBits.first
|
115
|
+
q[x].blue = Magick::MaxRGB * SmileBits.first
|
116
|
+
SmileBits.shift
|
117
|
+
end
|
118
|
+
# Store the row of pixels
|
119
|
+
i.store_pixels(0, y, SmileWidth, 1, q)
|
120
|
+
end
|
121
|
+
|
122
|
+
# i.display # Now display the result
|
123
|
+
i.write('smile.gif')
|
124
|
+
exit
|
data/doc/ex/solarize.rb
ADDED
data/doc/ex/splice.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
include Magick
|
4
|
+
|
5
|
+
# Demonstrate the splice method.
|
6
|
+
|
7
|
+
img = Image.read('images/Flower_Hat.jpg').first
|
8
|
+
|
9
|
+
begin
|
10
|
+
spliced_img = img.splice(img.columns/2, img.rows/2, 20, 20, 'gray80')
|
11
|
+
spliced_img.write('splice.jpg')
|
12
|
+
rescue NotImplementedError
|
13
|
+
not_implemented = Magick::Image.read("images/notimplemented.gif").first
|
14
|
+
not_implemented.write('splice.jpg')
|
15
|
+
end
|
16
|
+
|
data/doc/ex/spread.rb
ADDED
data/doc/ex/stegano.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
require 'RMagick'
|
3
|
+
|
4
|
+
# Demonstrate the Image#stegano method.
|
5
|
+
|
6
|
+
# Create a small watermark from the Snake image by
|
7
|
+
# shrinking it and converting it to B&W.
|
8
|
+
begin
|
9
|
+
watermark = Magick::Image.read('images/Snake.wmf').first
|
10
|
+
watermark.scale!(64.0/watermark.rows)
|
11
|
+
watermark = watermark.quantize(256, Magick::GRAYColorspace)
|
12
|
+
wmrows = watermark.rows
|
13
|
+
wmcols = watermark.columns
|
14
|
+
|
15
|
+
# Read the image in which we'll hide the watermark.
|
16
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
17
|
+
img.scale!(250.0/img.rows)
|
18
|
+
|
19
|
+
# Embed the watermark starting at offset 91.
|
20
|
+
puts 'Embedding watermark...'
|
21
|
+
stegano = img.stegano(watermark, 91)
|
22
|
+
|
23
|
+
# Write the watermarked image in MIFF format. Note that
|
24
|
+
# the format must be lossless - Image#stegano doesn't work
|
25
|
+
# with lossy formats like JPEG.
|
26
|
+
stegano.write('img.miff')
|
27
|
+
|
28
|
+
# Read the image and retrieve the watermark. The size
|
29
|
+
# attribute describes the size and offset of the watermark.
|
30
|
+
|
31
|
+
# This can take some time. Keep track of how far along we are.
|
32
|
+
monitor = Proc.new { |text, quantum, span|
|
33
|
+
printf("%s %3.0f%% complete\n", text, ((1.0-(quantum/span.to_f))*100.0))
|
34
|
+
}
|
35
|
+
Magick.set_monitor(monitor)
|
36
|
+
stegano = Magick::Image.read('stegano:img.miff') {
|
37
|
+
self.size = Magick::Geometry.new(wmcols, wmrows, 91)
|
38
|
+
}
|
39
|
+
Magick.set_monitor(nil)
|
40
|
+
|
41
|
+
# We don't need this any more.
|
42
|
+
File.delete('img.miff')
|
43
|
+
|
44
|
+
stegano[0].write('stegano.gif')
|
45
|
+
|
46
|
+
rescue Magick::ImageMagickError
|
47
|
+
puts "#{$0}: ImageMagickError - #{$!}"
|
48
|
+
end
|
49
|
+
|
50
|
+
exit
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#! /usr/local/bin/ruby -w
|
2
|
+
|
3
|
+
require 'RMagick'
|
4
|
+
|
5
|
+
imgl = Magick::ImageList.new
|
6
|
+
imgl.new_image(500,180, Magick::HatchFill.new('white','lightcyan2'))
|
7
|
+
gc = Magick::Draw.new
|
8
|
+
|
9
|
+
gc.stroke_width(5)
|
10
|
+
gc.fill('transparent')
|
11
|
+
|
12
|
+
gc.stroke_dasharray(30,10, 10,10)
|
13
|
+
gc.stroke('green')
|
14
|
+
gc.line(10, 20, 490, 20)
|
15
|
+
|
16
|
+
gc.stroke_dasharray(5,10,5)
|
17
|
+
gc.stroke_dashoffset(10)
|
18
|
+
gc.stroke('blue')
|
19
|
+
gc.line(10, 80, 490, 80)
|
20
|
+
|
21
|
+
gc.stroke_dasharray(10,10)
|
22
|
+
gc.stroke_dashoffset(0)
|
23
|
+
gc.stroke('red')
|
24
|
+
gc.line(10, 140, 490, 140)
|
25
|
+
|
26
|
+
gc.fill('black')
|
27
|
+
gc.stroke('transparent')
|
28
|
+
|
29
|
+
gc.gravity(Magick::CenterGravity)
|
30
|
+
gc.text( 0, -60, "'gc.stroke_dasharray(30, 10, 10, 10)'")
|
31
|
+
gc.text( 0, 0, "'gc.stroke_dasharray(5, 10, 5)'")
|
32
|
+
gc.text( 0, 12, "'gc.stroke_dashoffset(10)'")
|
33
|
+
gc.text( 0, 60, "'gc.stroke_dasharray(10, 10)'")
|
34
|
+
|
35
|
+
gc.draw(imgl)
|
36
|
+
|
37
|
+
imgl.border!(1,1,"lightcyan2")
|
38
|
+
#imgl.display
|
39
|
+
imgl.write("stroke_dasharray.gif")
|
40
|
+
exit
|
41
|
+
|