rmagick 1.15.17 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- data/ChangeLog +78 -25
- data/README.html +117 -188
- data/README.txt +116 -181
- data/build_tarball.rake +205 -0
- data/doc/comtasks.html +2 -2
- data/doc/constants.html +118 -44
- data/doc/draw.html +57 -99
- data/doc/ex/adaptive_threshold.rb +1 -10
- data/doc/ex/add_noise.rb +4 -5
- data/doc/ex/axes.rb +1 -1
- data/doc/ex/bilevel_channel.rb +2 -13
- data/doc/ex/bounding_box.rb +3 -4
- data/doc/ex/channel.rb +6 -7
- data/doc/ex/clip_path.rb +11 -5
- data/doc/ex/color_histogram.rb +8 -20
- data/doc/ex/composite_layers.rb +53 -0
- data/doc/ex/fill_pattern.rb +26 -0
- data/doc/ex/get_multiline_type_metrics.rb +26 -37
- data/doc/ex/get_type_metrics.rb +25 -25
- data/doc/ex/images/notimplemented.gif +0 -0
- data/doc/ex/level.rb +1 -1
- data/doc/ex/matte_floodfill.rb +5 -6
- data/doc/ex/matte_replace.rb +5 -6
- data/doc/ex/negate_channel.rb +0 -10
- data/doc/ex/opacity.rb +3 -5
- data/doc/ex/polaroid.rb +4 -1
- data/doc/ex/posterize.rb +1 -12
- data/doc/ex/preview.rb +1 -8
- data/doc/ex/radial_blur.rb +1 -11
- data/doc/ex/raise.rb +1 -4
- data/doc/ex/random_threshold_channel.rb +4 -9
- data/doc/ex/sepiatone.rb +2 -9
- data/doc/ex/shadow.rb +12 -18
- data/doc/ex/sketch.rb +2 -9
- data/doc/ex/smile.rb +7 -7
- data/doc/ex/splice.rb +3 -10
- data/doc/ex/stegano.rb +5 -0
- data/doc/ex/threshold.rb +2 -2
- data/doc/ex/transpose.rb +1 -8
- data/doc/ex/transverse.rb +1 -8
- data/doc/ex/trim.rb +1 -2
- data/doc/ex/viewex.rb +4 -5
- data/doc/ex/vignette.rb +1 -8
- data/doc/ex/watermark.rb +1 -0
- data/doc/ex/wet_floor.rb +8 -14
- data/doc/ilist.html +301 -110
- data/doc/image1.html +362 -258
- data/doc/image2.html +429 -286
- data/doc/image3.html +418 -192
- data/doc/imageattrs.html +100 -39
- data/doc/imusage.html +26 -21
- data/doc/index.html +52 -93
- data/doc/info.html +160 -64
- data/doc/magick.html +37 -71
- data/doc/optequiv.html +155 -61
- data/doc/rvg.html +3 -3
- data/doc/rvgclip.html +2 -2
- data/doc/rvggroup.html +2 -2
- data/doc/rvgimage.html +3 -3
- data/doc/rvgpattern.html +3 -3
- data/doc/rvgshape.html +2 -2
- data/doc/rvgstyle.html +2 -2
- data/doc/rvgtext.html +2 -2
- data/doc/rvgtspan.html +4 -4
- data/doc/rvgtut.html +4 -4
- data/doc/rvguse.html +3 -3
- data/doc/rvgxform.html +2 -2
- data/doc/struct.html +26 -29
- data/doc/usage.html +99 -48
- data/examples/crop_with_gravity.rb +46 -0
- data/examples/demo.rb +2 -2
- data/examples/histogram.rb +11 -11
- data/examples/identify.rb +45 -45
- data/examples/spinner.rb +3 -2
- data/ext/RMagick/MANIFEST +7 -8
- data/ext/RMagick/extconf.rb +242 -0
- data/ext/RMagick/rmagick.h +136 -222
- data/ext/RMagick/rmdraw.c +226 -229
- data/ext/RMagick/rmfill.c +69 -118
- data/ext/RMagick/rmilist.c +234 -94
- data/ext/RMagick/rmimage.c +1719 -2564
- data/ext/RMagick/rminfo.c +433 -619
- data/ext/RMagick/rmmain.c +249 -487
- data/ext/RMagick/rmutil.c +344 -563
- data/lib/RMagick.rb +414 -358
- data/lib/rvg/clippath.rb +2 -2
- data/lib/rvg/container.rb +2 -2
- data/lib/rvg/describable.rb +2 -2
- data/lib/rvg/embellishable.rb +2 -2
- data/lib/rvg/misc.rb +3 -3
- data/lib/rvg/paint.rb +2 -7
- data/lib/rvg/pathdata.rb +2 -2
- data/lib/rvg/rvg.rb +2 -2
- data/lib/rvg/stretchable.rb +2 -14
- data/lib/rvg/stylable.rb +2 -2
- data/lib/rvg/text.rb +2 -2
- data/lib/rvg/transformable.rb +2 -2
- data/lib/rvg/units.rb +2 -2
- data/{metaconfig.in → metaconfig} +0 -1
- data/post-setup.rb +1 -1
- data/rmagick.gemspec +6 -9
- metadata +41 -49
- data/Makefile.in +0 -42
- data/configure +0 -12358
- data/configure.ac +0 -791
- data/ext/RMagick/extconf.rb.in +0 -25
- data/ext/RMagick/rmagick_config.h.in +0 -285
- data/gem_extconf.rb +0 -42
Binary file
|
data/doc/ex/level.rb
CHANGED
data/doc/ex/matte_floodfill.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
2
|
|
3
3
|
require 'RMagick'
|
4
|
-
include Magick
|
5
4
|
|
6
|
-
img = Image.new(200,200)
|
7
|
-
img.compression = LZWCompression
|
5
|
+
img = Magick::Image.new(200,200)
|
6
|
+
img.compression = Magick::LZWCompression
|
8
7
|
|
9
|
-
bg = Image.read('plasma:fractal') { self.size = '200x200' }
|
8
|
+
bg = Magick::Image.read('plasma:fractal') { self.size = '200x200' }
|
10
9
|
bg[0].matte = false
|
11
10
|
|
12
|
-
gc = Draw.new
|
11
|
+
gc = Magick::Draw.new
|
13
12
|
gc.stroke_width(2)
|
14
13
|
gc.stroke('black')
|
15
14
|
gc.fill('white')
|
@@ -27,7 +26,7 @@ img = img.matte_floodfill(100, 100)
|
|
27
26
|
|
28
27
|
# Composite the image over a nice bright background
|
29
28
|
# so that the transparent pixels will be obvious.
|
30
|
-
img = bg[0].composite(img, CenterGravity, OverCompositeOp)
|
29
|
+
img = bg[0].composite(img, Magick::CenterGravity, Magick::OverCompositeOp)
|
31
30
|
|
32
31
|
img.write('matte_floodfill_after.gif')
|
33
32
|
exit
|
data/doc/ex/matte_replace.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
2
|
|
3
3
|
require 'RMagick'
|
4
|
-
include Magick
|
5
4
|
|
6
|
-
img = Image.new(200,200)
|
7
|
-
img.compression = LZWCompression
|
5
|
+
img = Magick::Image.new(200,200)
|
6
|
+
img.compression = Magick::LZWCompression
|
8
7
|
|
9
|
-
bg = Image.read('plasma:fractal') { self.size = '200x200' }
|
8
|
+
bg = Magick::Image.read('plasma:fractal') { self.size = '200x200' }
|
10
9
|
bg[0].matte = false
|
11
10
|
|
12
|
-
gc = Draw.new
|
11
|
+
gc = Magick::Draw.new
|
13
12
|
gc.stroke_width(2)
|
14
13
|
gc.stroke('black')
|
15
14
|
gc.fill('white')
|
@@ -34,7 +33,7 @@ img = img.matte_replace(100, 45)
|
|
34
33
|
|
35
34
|
# Composite the image over a nice bright background
|
36
35
|
# so that the transparent pixels will be obvious.
|
37
|
-
img = bg[0].composite(img, CenterGravity, OverCompositeOp)
|
36
|
+
img = bg[0].composite(img, Magick::CenterGravity, Magick::OverCompositeOp)
|
38
37
|
|
39
38
|
img.write('matte_replace_after.gif')
|
40
39
|
exit
|
data/doc/ex/negate_channel.rb
CHANGED
@@ -4,16 +4,6 @@ require 'RMagick'
|
|
4
4
|
# Demonstrate the Image#negate_channel method
|
5
5
|
|
6
6
|
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
|
-
|
8
|
-
begin
|
9
|
-
|
10
7
|
result = img.negate_channel(false, Magick::GreenChannel)
|
11
|
-
|
12
|
-
# Substitute the standard "Not Implemented" image
|
13
|
-
rescue NotImplementedError
|
14
|
-
result = Magick::Image.read("images/notimplemented.gif").first
|
15
|
-
result.resize!(img.columns, img.rows)
|
16
|
-
end
|
17
|
-
|
18
8
|
result.write('negate_channel.jpg')
|
19
9
|
exit
|
data/doc/ex/opacity.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
|
-
|
3
2
|
require 'RMagick'
|
4
|
-
include Magick
|
5
3
|
|
6
|
-
canvas = Image.new(260, 125)
|
7
|
-
gc = Draw.new
|
4
|
+
canvas = Magick::Image.new(260, 125)
|
5
|
+
gc = Magick::Draw.new
|
8
6
|
gc.fill('black')
|
9
7
|
gc.rectangle(10,20, 250,90)
|
10
8
|
|
@@ -26,7 +24,7 @@ gc.roundrectangle(200,20, 240,90, 5,5)
|
|
26
24
|
|
27
25
|
gc.stroke('transparent')
|
28
26
|
gc.fill('black')
|
29
|
-
gc.gravity(SouthGravity)
|
27
|
+
gc.gravity(Magick::SouthGravity)
|
30
28
|
gc.text(-90,20, '"25%%"')
|
31
29
|
gc.text(-30,20, '"50%%"')
|
32
30
|
gc.text( 30,20, '"75%%"')
|
data/doc/ex/polaroid.rb
CHANGED
@@ -8,7 +8,10 @@ img = Magick::Image.read('images/Flower_Hat.jpg').first
|
|
8
8
|
img[:Caption] = "\nLosha\n" + Date.today.to_s
|
9
9
|
|
10
10
|
begin
|
11
|
-
picture = img.polaroid
|
11
|
+
picture = img.polaroid do
|
12
|
+
self.gravity = Magick::CenterGravity
|
13
|
+
self.border_color = "#f0f0f8"
|
14
|
+
end
|
12
15
|
|
13
16
|
# Composite it on a white background so the result is opaque.
|
14
17
|
background = Magick::Image.new(picture.columns, picture.rows)
|
data/doc/ex/posterize.rb
CHANGED
@@ -1,19 +1,8 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
2
|
|
3
3
|
require 'RMagick'
|
4
|
-
include Magick
|
5
|
-
|
6
|
-
img = Image.read('images/Flower_Hat.jpg').first
|
7
|
-
|
8
|
-
begin
|
9
4
|
|
5
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
10
6
|
result = img.posterize
|
11
|
-
|
12
|
-
# Substitute the standard "Not Implemented" image
|
13
|
-
rescue NotImplementedError
|
14
|
-
result = Magick::Image.read("images/notimplemented.gif").first
|
15
|
-
result.resize!(img.columns, img.rows)
|
16
|
-
end
|
17
|
-
|
18
7
|
result.write('posterize.jpg')
|
19
8
|
exit
|
data/doc/ex/preview.rb
CHANGED
@@ -3,14 +3,7 @@
|
|
3
3
|
require 'RMagick'
|
4
4
|
|
5
5
|
img = Magick::Image.read("images/Flower_Hat.jpg").first
|
6
|
-
|
7
|
-
begin
|
8
|
-
preview = img.preview(Magick::SolarizePreview)
|
9
|
-
rescue NotImplementedError
|
10
|
-
img = Magick::Image.read('images/notimplemented.gif').first
|
11
|
-
img.write('preview.jpg')
|
12
|
-
exit
|
13
|
-
end
|
6
|
+
preview = img.preview(Magick::SolarizePreview)
|
14
7
|
preview.minify.write('preview.jpg')
|
15
8
|
exit
|
16
9
|
|
data/doc/ex/radial_blur.rb
CHANGED
@@ -4,16 +4,6 @@ require 'RMagick'
|
|
4
4
|
# Demonstrate the Image#radial_blur method
|
5
5
|
|
6
6
|
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
|
-
|
8
|
-
# Make a blurry copy.
|
9
|
-
begin
|
10
|
-
result = img.radial_blur(10.0)
|
11
|
-
|
12
|
-
# Substitute the standard "Not Implemented" image
|
13
|
-
rescue NotImplementedError
|
14
|
-
result = Magick::Image.read("images/notimplemented.gif").first
|
15
|
-
result.resize!(img.columns, img.rows)
|
16
|
-
end
|
17
|
-
|
7
|
+
result = img.radial_blur(10.0)
|
18
8
|
result.write('radial_blur.jpg')
|
19
9
|
exit
|
data/doc/ex/raise.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
2
|
require 'RMagick'
|
3
|
-
include Magick
|
4
3
|
|
5
4
|
# Demonstrate the Image#raise method.
|
6
|
-
img = Image.read('images/Flower_Hat.jpg').first
|
7
|
-
|
5
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
8
6
|
img = img.raise
|
9
|
-
|
10
7
|
img.write('raise.jpg')
|
11
8
|
exit
|
@@ -1,18 +1,13 @@
|
|
1
|
-
#!/
|
1
|
+
#!/usr/local/bin/ruby -w
|
2
2
|
|
3
3
|
# Demonstrate the random_channel_threshold method
|
4
4
|
|
5
5
|
require 'RMagick'
|
6
|
-
include Magick
|
7
6
|
|
8
|
-
img = Image.read('images/Flower_Hat.jpg').first
|
7
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
img2 = img.random_threshold_channel(geom, RedChannel)
|
13
|
-
rescue NotImplementedError
|
14
|
-
img2 = Image.read('images/notimplemented.gif').first
|
15
|
-
end
|
9
|
+
geom = Magick::Geometry.new(Magick::QuantumRange/2)
|
10
|
+
img2 = img.random_threshold_channel(geom, Magick::RedChannel)
|
16
11
|
|
17
12
|
img2.write('random_threshold_channel.jpg')
|
18
13
|
exit
|
data/doc/ex/sepiatone.rb
CHANGED
@@ -1,15 +1,8 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
2
|
|
3
3
|
require 'RMagick'
|
4
|
-
include Magick
|
5
|
-
|
6
|
-
img = Image.read('images/Flower_Hat.jpg').first
|
7
|
-
|
8
|
-
begin
|
9
|
-
sepiatone = img.sepiatone(MaxRGB * 0.8)
|
10
|
-
rescue NotImplementedError
|
11
|
-
sepiatone = Image.read('images/notimplemented.gif').first
|
12
|
-
end
|
13
4
|
|
5
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
6
|
+
sepiatone = img.sepiatone(Magick::QuantumRange * 0.8)
|
14
7
|
sepiatone.write('sepiatone.jpg')
|
15
8
|
|
data/doc/ex/shadow.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
require 'RMagick'
|
2
|
-
include Magick
|
3
2
|
|
4
3
|
# Draw a big red Bezier curve on a transparent background.
|
5
|
-
img = Image.new(340, 120) {self.background_color = 'none'}
|
6
|
-
gc = Draw.new
|
4
|
+
img = Magick::Image.new(340, 120) {self.background_color = 'none'}
|
5
|
+
gc = Magick::Draw.new
|
7
6
|
gc.fill('none')
|
8
7
|
gc.stroke('red')
|
9
8
|
gc.stroke_linecap('round')
|
@@ -14,24 +13,19 @@ gc.draw(img)
|
|
14
13
|
# Composite it onto a white background, draw a border around the result,
|
15
14
|
# write it to the "before" file.
|
16
15
|
before = img.copy
|
17
|
-
bg = Image.new(before.columns, before.rows) {self.background_color='white'}
|
18
|
-
before = bg.composite(before, CenterGravity, OverCompositeOp)
|
16
|
+
bg = Magick::Image.new(before.columns, before.rows) {self.background_color='white'}
|
17
|
+
before = bg.composite(before, Magick::CenterGravity, Magick::OverCompositeOp)
|
19
18
|
before.border!(1,1,'gray80')
|
20
19
|
before.write('shadow_before.gif')
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
after.border!(1,1,'gray80')
|
31
|
-
rescue NotImplementedError
|
32
|
-
after = Image.read('images/notimplemented.gif').first
|
33
|
-
after.resize!(before.columns, before.rows)
|
34
|
-
end
|
21
|
+
# Create the shadow.
|
22
|
+
shadow = img.shadow()
|
23
|
+
# Composite the original image over the shadow, composite the result
|
24
|
+
# onto a white background, add a border, write it to the "after" file.
|
25
|
+
shadow = shadow.composite(img, Magick::NorthWestGravity, Magick::OverCompositeOp)
|
26
|
+
bg = Magick::Image.new(shadow.columns, shadow.rows) {self.background_color='white'}
|
27
|
+
after = bg.composite(shadow, Magick::CenterGravity, Magick::OverCompositeOp)
|
28
|
+
after.border!(1,1,'gray80')
|
35
29
|
|
36
30
|
after.write('shadow_after.gif')
|
37
31
|
|
data/doc/ex/sketch.rb
CHANGED
@@ -11,15 +11,8 @@ sketch = img.quantize(256, Magick::GRAYColorspace)
|
|
11
11
|
sketch = sketch.equalize
|
12
12
|
|
13
13
|
# Sketch, then dissolve 25% of the original back in
|
14
|
-
|
15
|
-
|
16
|
-
img = img.dissolve(sketch, 0.75, 0.25)
|
17
|
-
|
18
|
-
rescue NotImplementedError
|
19
|
-
not_impl = Magick::Image.read('images/notimplemented.gif').first
|
20
|
-
not_impl.resize!(img.columns, img.rows)
|
21
|
-
img = not_impl
|
22
|
-
end
|
14
|
+
sketch = sketch.sketch(0, 10, 135)
|
15
|
+
img = img.dissolve(sketch, 0.75, 0.25)
|
23
16
|
|
24
17
|
img.write('sketch.jpg')
|
25
18
|
|
data/doc/ex/smile.rb
CHANGED
@@ -101,20 +101,20 @@ SmileBits = [
|
|
101
101
|
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,
|
102
102
|
0, 0, 0, 0 ]
|
103
103
|
|
104
|
-
|
105
|
-
|
104
|
+
img = Image.new(SmileWidth, SmileHeight)
|
105
|
+
|
106
106
|
q = Array.new # Create an array of pixels one
|
107
107
|
SmileWidth.times do # row long
|
108
108
|
q << Magick::Pixel.new(0,0,0,0)
|
109
109
|
end
|
110
110
|
|
111
|
-
|
111
|
+
n = 0
|
112
112
|
SmileHeight.times do |y| # Store pixels a row at a time
|
113
113
|
SmileWidth.times do |x| # Build a row of pixels
|
114
|
-
q[x].red =
|
115
|
-
q[x].green =
|
116
|
-
q[x].blue =
|
117
|
-
|
114
|
+
q[x].red = QuantumRange * SmileBits[n]
|
115
|
+
q[x].green = QuantumRange * SmileBits[n]
|
116
|
+
q[x].blue = QuantumRange * SmileBits[n]
|
117
|
+
n += 1
|
118
118
|
end
|
119
119
|
# Store the row of pixels
|
120
120
|
img.store_pixels(0, y, SmileWidth, 1, q)
|
data/doc/ex/splice.rb
CHANGED
@@ -1,16 +1,9 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
2
|
require 'RMagick'
|
3
|
-
include Magick
|
4
3
|
|
5
4
|
# Demonstrate the splice method.
|
6
5
|
|
7
|
-
img = Image.read('images/Flower_Hat.jpg').first
|
8
|
-
|
9
|
-
|
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
|
6
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
|
+
spliced_img = img.splice(img.columns/2, img.rows/2, 20, 20, 'gray80')
|
8
|
+
spliced_img.write('splice.jpg')
|
16
9
|
|
data/doc/ex/stegano.rb
CHANGED
@@ -29,6 +29,8 @@ begin
|
|
29
29
|
# Read the image and retrieve the watermark. The size
|
30
30
|
# attribute describes the size and offset of the watermark.
|
31
31
|
|
32
|
+
# This can take some time. Keep track of how far along we are.
|
33
|
+
|
32
34
|
monitor = Proc.new do |text, quantum, span|
|
33
35
|
printf("Extracting watermark...%3.0f%% complete\n", ((1.0-(quantum/span.to_f))*100.0))
|
34
36
|
true
|
@@ -36,8 +38,11 @@ begin
|
|
36
38
|
|
37
39
|
stegano = Magick::Image.read('stegano:img.miff') do
|
38
40
|
self.size = Magick::Geometry.new(wmcols, wmrows, 91)
|
41
|
+
self.monitor = monitor
|
39
42
|
end
|
40
43
|
|
44
|
+
stegano[0].monitor = nil
|
45
|
+
|
41
46
|
# We don't need this any more.
|
42
47
|
File.delete('img.miff')
|
43
48
|
|
data/doc/ex/threshold.rb
CHANGED
@@ -5,8 +5,8 @@ require 'RMagick'
|
|
5
5
|
|
6
6
|
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
7
|
|
8
|
-
# Use a threshold of 55% of
|
9
|
-
img = img.threshold(Magick::
|
8
|
+
# Use a threshold of 55% of QuantumRange.
|
9
|
+
img = img.threshold(Magick::QuantumRange*0.55)
|
10
10
|
|
11
11
|
#img.display
|
12
12
|
img.write('threshold.jpg')
|
data/doc/ex/transpose.rb
CHANGED
@@ -4,13 +4,6 @@ require 'RMagick'
|
|
4
4
|
# Demonstrate the Image#transpose method
|
5
5
|
|
6
6
|
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
|
-
|
8
|
-
begin
|
9
|
-
img = img.transpose
|
10
|
-
rescue NotImplementedError
|
11
|
-
not_implemented = Magick::Image.read("images/notimplemented.gif").first
|
12
|
-
not_implemented.resize!(img.columns, img.rows)
|
13
|
-
img = not_implemented
|
14
|
-
end
|
7
|
+
img = img.transpose
|
15
8
|
img.write('transpose.jpg')
|
16
9
|
exit
|
data/doc/ex/transverse.rb
CHANGED
@@ -4,13 +4,6 @@ require 'RMagick'
|
|
4
4
|
# Demonstrate the Image#transverse method
|
5
5
|
|
6
6
|
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
7
|
-
|
8
|
-
begin
|
9
|
-
img = img.transverse
|
10
|
-
rescue NotImplementedError
|
11
|
-
not_implemented = Magick::Image.read("images/notimplemented.gif").first
|
12
|
-
not_implemented.resize!(img.columns, img.rows)
|
13
|
-
img = not_implemented
|
14
|
-
end
|
7
|
+
img = img.transverse
|
15
8
|
img.write('transverse.jpg')
|
16
9
|
exit
|
data/doc/ex/trim.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'RMagick'
|
2
|
-
include Magick
|
3
2
|
|
4
3
|
# Demonstrate the trim method
|
5
4
|
|
6
5
|
# Read the Flower_Hat image and reduce it to 80% of its original size.
|
7
|
-
img = Image.read('images/Flower_Hat.jpg').first
|
6
|
+
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
8
7
|
cols = img.columns
|
9
8
|
rows = img.rows
|
10
9
|
img.resize!(0.80)
|
data/doc/ex/viewex.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
#! /usr/local/bin/ruby -w
|
2
2
|
|
3
3
|
require 'RMagick'
|
4
|
-
include Magick
|
5
4
|
|
6
|
-
img = Image.new(40, 40) {self.background_color = 'lightcyan2'}
|
5
|
+
img = Magick::Image.new(40, 40) {self.background_color = 'lightcyan2'}
|
7
6
|
|
8
7
|
# The view is 400 pixels square, starting
|
9
8
|
# column 10, row 5 from the top of the image.
|
10
9
|
img.view( 10, 5, 20, 20) do |view|
|
11
10
|
|
12
11
|
# Set all the pixels in the view to green.
|
13
|
-
view[][] = Pixel.new(0,
|
12
|
+
view[][] = Magick::Pixel.new(0, Magick::QuantumRange)
|
14
13
|
|
15
14
|
# Change the top and bottom rows to red.
|
16
15
|
view[0][] = 'red'
|
@@ -24,11 +23,11 @@ img.view( 10, 5, 20, 20) do |view|
|
|
24
23
|
|
25
24
|
# Change the green channel of all the
|
26
25
|
# pixels on row 8.
|
27
|
-
view[8][].green =
|
26
|
+
view[8][].green = Magick::QuantumRange/2
|
28
27
|
|
29
28
|
# Change the blue channel of 8 pixels
|
30
29
|
# on column 10.
|
31
|
-
view[4,8][10].blue =
|
30
|
+
view[4,8][10].blue = Magick::QuantumRange
|
32
31
|
end
|
33
32
|
|
34
33
|
img.scale(5).write("viewex.gif")
|