rmagick 2.16.0 → 3.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.
- checksums.yaml +5 -5
- data/.appveyor.yml +19 -0
- data/.circleci/config.yml +56 -0
- data/.rubocop.yml +8 -335
- data/.rubocop_todo.yml +255 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -49
- data/CHANGELOG.md +23 -0
- data/CONTRIBUTING.md +34 -0
- data/Gemfile +0 -6
- data/README.textile +11 -3
- data/Rakefile +23 -15
- data/before_install_linux.sh +12 -15
- data/doc/ex/InitialCoords.rb +4 -4
- data/doc/ex/NewCoordSys.rb +4 -4
- data/doc/ex/OrigCoordSys.rb +2 -2
- data/doc/ex/PreserveAspectRatio.rb +34 -34
- data/doc/ex/RotateScale.rb +7 -7
- data/doc/ex/Skew.rb +7 -7
- data/doc/ex/Use01.rb +1 -1
- data/doc/ex/Use02.rb +4 -4
- data/doc/ex/Use03.rb +2 -2
- data/doc/ex/ViewBox.rb +4 -4
- data/doc/ex/affine.rb +5 -5
- data/doc/ex/affine_transform.rb +3 -3
- data/doc/ex/arc.rb +9 -9
- data/doc/ex/arcpath.rb +2 -2
- data/doc/ex/arcs01.rb +6 -6
- data/doc/ex/arcs02.rb +8 -8
- data/doc/ex/axes.rb +11 -11
- data/doc/ex/baseline_shift01.rb +5 -5
- data/doc/ex/bilevel_channel.rb +1 -1
- data/doc/ex/blur_image.rb +1 -1
- data/doc/ex/border.rb +1 -1
- data/doc/ex/bounding_box.rb +11 -11
- data/doc/ex/cbezier1.rb +12 -12
- data/doc/ex/cbezier2.rb +13 -13
- data/doc/ex/cbezier3.rb +13 -13
- data/doc/ex/cbezier4.rb +13 -13
- data/doc/ex/cbezier5.rb +13 -13
- data/doc/ex/cbezier6.rb +19 -19
- data/doc/ex/channel.rb +2 -2
- data/doc/ex/chop.rb +2 -2
- data/doc/ex/circle.rb +7 -7
- data/doc/ex/circle01.rb +2 -2
- data/doc/ex/clip_path.rb +6 -6
- data/doc/ex/coalesce.rb +6 -6
- data/doc/ex/color_fill_to_border.rb +8 -8
- data/doc/ex/color_floodfill.rb +8 -8
- data/doc/ex/color_histogram.rb +2 -2
- data/doc/ex/color_reset.rb +2 -2
- data/doc/ex/colors.rb +4 -4
- data/doc/ex/compose_mask.rb +2 -2
- data/doc/ex/composite.rb +39 -39
- data/doc/ex/composite_layers.rb +1 -2
- data/doc/ex/contrast.rb +3 -3
- data/doc/ex/crop.rb +2 -2
- data/doc/ex/crop_with_gravity.rb +5 -5
- data/doc/ex/cubic01.rb +12 -12
- data/doc/ex/cubic02.rb +22 -22
- data/doc/ex/cycle_colormap.rb +3 -3
- data/doc/ex/dissolve.rb +0 -0
- data/doc/ex/drawcomp.rb +8 -9
- data/doc/ex/drop_shadow.rb +4 -4
- data/doc/ex/ellipse.rb +9 -9
- data/doc/ex/ellipse01.rb +3 -3
- data/doc/ex/enhance.rb +2 -2
- data/doc/ex/evenodd.rb +19 -19
- data/doc/ex/fill_pattern.rb +3 -3
- data/doc/ex/flatten_images.rb +1 -1
- data/doc/ex/font_styles.rb +13 -13
- data/doc/ex/fonts.rb +2 -6
- data/doc/ex/frame.rb +1 -1
- data/doc/ex/get_multiline_type_metrics.rb +3 -3
- data/doc/ex/get_pixels.rb +4 -6
- data/doc/ex/get_type_metrics.rb +26 -25
- data/doc/ex/gradientfill.rb +2 -2
- data/doc/ex/grav.rb +12 -12
- data/doc/ex/gravity.rb +14 -16
- data/doc/ex/group.rb +11 -11
- data/doc/ex/hatchfill.rb +2 -2
- data/doc/ex/image.rb +9 -9
- data/doc/ex/implode.rb +2 -2
- data/doc/ex/line.rb +10 -10
- data/doc/ex/line01.rb +7 -7
- data/doc/ex/mask.rb +0 -0
- data/doc/ex/matte_fill_to_border.rb +3 -3
- data/doc/ex/matte_floodfill.rb +2 -2
- data/doc/ex/matte_replace.rb +3 -3
- data/doc/ex/median_filter.rb +2 -2
- data/doc/ex/mono.rb +2 -2
- data/doc/ex/morph.rb +1 -1
- data/doc/ex/mosaic.rb +7 -5
- data/doc/ex/motion_blur.rb +1 -1
- data/doc/ex/negate_channel.rb +0 -0
- data/doc/ex/nested_rvg.rb +2 -2
- data/doc/ex/nonzero.rb +19 -19
- data/doc/ex/opacity.rb +9 -9
- data/doc/ex/path.rb +17 -17
- data/doc/ex/pattern1.rb +4 -4
- data/doc/ex/pattern2.rb +2 -2
- data/doc/ex/polaroid.rb +0 -1
- data/doc/ex/polygon.rb +7 -7
- data/doc/ex/polygon01.rb +7 -7
- data/doc/ex/polyline.rb +7 -7
- data/doc/ex/polyline01.rb +8 -8
- data/doc/ex/posterize.rb +0 -0
- data/doc/ex/qbezierpath.rb +16 -16
- data/doc/ex/quad01.rb +6 -6
- data/doc/ex/quantize-m.rb +2 -2
- data/doc/ex/random_threshold_channel.rb +1 -1
- data/doc/ex/rect01.rb +2 -2
- data/doc/ex/rect02.rb +3 -3
- data/doc/ex/rectangle.rb +6 -6
- data/doc/ex/reduce_noise.rb +2 -2
- data/doc/ex/remap.rb +0 -0
- data/doc/ex/resize_to_fill.rb +0 -0
- data/doc/ex/resize_to_fit.rb +0 -0
- data/doc/ex/roll.rb +1 -1
- data/doc/ex/rotate.rb +8 -8
- data/doc/ex/rotate_f.rb +1 -1
- data/doc/ex/roundrect.rb +6 -6
- data/doc/ex/rubyname.rb +4 -4
- data/doc/ex/rvg_clippath.rb +3 -3
- data/doc/ex/rvg_linecap.rb +7 -7
- data/doc/ex/rvg_linejoin.rb +7 -7
- data/doc/ex/rvg_opacity.rb +5 -5
- data/doc/ex/rvg_pattern.rb +8 -8
- data/doc/ex/rvg_stroke_dasharray.rb +2 -2
- data/doc/ex/sepiatone.rb +0 -0
- data/doc/ex/shadow.rb +6 -6
- data/doc/ex/shear.rb +2 -2
- data/doc/ex/skewx.rb +8 -8
- data/doc/ex/skewy.rb +9 -9
- data/doc/ex/smile.rb +5 -4
- data/doc/ex/sparse_color.rb +0 -4
- data/doc/ex/splice.rb +1 -1
- data/doc/ex/stegano.rb +4 -5
- data/doc/ex/stroke_dasharray.rb +10 -10
- data/doc/ex/stroke_fill.rb +2 -2
- data/doc/ex/stroke_linecap.rb +12 -12
- data/doc/ex/stroke_linejoin.rb +12 -12
- data/doc/ex/stroke_width.rb +11 -11
- data/doc/ex/swirl.rb +2 -2
- data/doc/ex/text.rb +6 -6
- data/doc/ex/text01.rb +4 -4
- data/doc/ex/text_align.rb +5 -5
- data/doc/ex/text_antialias.rb +2 -2
- data/doc/ex/text_styles.rb +8 -8
- data/doc/ex/text_undercolor.rb +4 -4
- data/doc/ex/texture_fill_to_border.rb +8 -8
- data/doc/ex/texture_floodfill.rb +8 -8
- data/doc/ex/texturefill.rb +2 -2
- data/doc/ex/threshold.rb +2 -2
- data/doc/ex/to_blob.rb +1 -1
- data/doc/ex/translate.rb +8 -8
- data/doc/ex/transparent.rb +6 -6
- data/doc/ex/transpose.rb +0 -0
- data/doc/ex/transverse.rb +0 -0
- data/doc/ex/tref01.rb +6 -6
- data/doc/ex/triangle01.rb +2 -2
- data/doc/ex/trim.rb +2 -2
- data/doc/ex/tspan01.rb +5 -5
- data/doc/ex/tspan02.rb +5 -5
- data/doc/ex/tspan03.rb +5 -5
- data/doc/ex/unsharp_mask.rb +3 -3
- data/doc/ex/viewex.rb +5 -5
- data/doc/ex/vignette.rb +0 -0
- data/doc/ex/watermark.rb +6 -6
- data/doc/ex/wet_floor.rb +2 -2
- data/doc/ex/writing_mode01.rb +12 -12
- data/doc/ex/writing_mode02.rb +12 -12
- data/examples/constitute.rb +1 -1
- data/examples/crop_with_gravity.rb +5 -5
- data/examples/demo.rb +6 -7
- data/examples/describe.rb +8 -10
- data/examples/find_similar_region.rb +3 -3
- data/examples/histogram.rb +192 -201
- data/examples/identify.rb +62 -73
- data/examples/image_opacity.rb +0 -1
- data/examples/import_export.rb +1 -1
- data/examples/pattern_fill.rb +3 -4
- data/examples/rotating_text.rb +5 -4
- data/examples/spinner.rb +5 -5
- data/examples/thumbnail.rb +3 -3
- data/examples/vignette.rb +5 -5
- data/ext/RMagick/extconf.rb +213 -230
- data/ext/RMagick/rmagick.c +1 -0
- data/ext/RMagick/rmagick.h +26 -29
- data/ext/RMagick/rmdraw.c +3 -38
- data/ext/RMagick/rmenum.c +36 -0
- data/ext/RMagick/rmimage.c +166 -10
- data/ext/RMagick/rminfo.c +7 -2
- data/ext/RMagick/rmkinfo.c +247 -0
- data/ext/RMagick/rmmain.c +96 -0
- data/ext/RMagick/rmutil.c +4 -0
- data/lib/rmagick/version.rb +3 -3
- data/lib/rmagick_internal.rb +226 -308
- data/lib/rvg/clippath.rb +2 -4
- data/lib/rvg/container.rb +25 -22
- data/lib/rvg/deep_equal.rb +11 -11
- data/lib/rvg/describable.rb +2 -2
- data/lib/rvg/embellishable.rb +60 -66
- data/lib/rvg/misc.rb +122 -128
- data/lib/rvg/pathdata.rb +15 -17
- data/lib/rvg/rvg.rb +41 -44
- data/lib/rvg/stretchable.rb +22 -28
- data/lib/rvg/stylable.rb +10 -10
- data/lib/rvg/text.rb +164 -165
- data/lib/rvg/transformable.rb +15 -15
- data/lib/rvg/units.rb +2 -2
- data/rmagick.gemspec +9 -33
- data/spec/rmagick/draw_spec.rb +5 -6
- data/spec/rmagick/image/blue_shift_spec.rb +1 -3
- data/spec/rmagick/image/channel_entropy_spec.rb +9 -0
- data/spec/rmagick/image/composite_spec.rb +2 -4
- data/spec/rmagick/image/constitute_spec.rb +2 -4
- data/spec/rmagick/image/dispatch_spec.rb +1 -3
- data/spec/rmagick/image/from_blob_spec.rb +1 -3
- data/spec/rmagick/image/ping_spec.rb +1 -3
- data/spec/rmagick/image/properties_spec.rb +0 -2
- data/spec/rmagick/image/read_spec.rb +28 -0
- data/spec/spec_helper.rb +7 -1
- data/spec/support/issue_200/app.rb +8 -0
- data/test/Image1.rb +70 -70
- data/test/Image2.rb +369 -361
- data/test/Image3.rb +64 -63
- data/test/ImageList1.rb +796 -792
- data/test/ImageList2.rb +43 -44
- data/test/Image_attributes.rb +26 -48
- data/test/Import_Export.rb +71 -77
- data/test/Info.rb +30 -31
- data/test/Magick.rb +47 -46
- data/test/Pixel.rb +24 -24
- data/test/Preview.rb +7 -6
- data/test/test_all_basic.rb +15 -7
- data/test/tmpnam_test.rb +3 -3
- metadata +57 -18
data/doc/ex/tspan03.rb
CHANGED
@@ -2,18 +2,18 @@ require 'rvg/rvg'
|
|
2
2
|
|
3
3
|
Magick::RVG.dpi = 90
|
4
4
|
|
5
|
-
rvg = Magick::RVG.new(10.cm, 3.cm).viewbox(0,0,1000,300) do |canvas|
|
5
|
+
rvg = Magick::RVG.new(10.cm, 3.cm).viewbox(0, 0, 1000, 300) do |canvas|
|
6
6
|
canvas.background_fill = 'white'
|
7
7
|
|
8
8
|
canvas.g.translate(100, 60) do |grp|
|
9
|
-
grp.text.styles(:
|
9
|
+
grp.text.styles(font_family: 'Verdana', font_size: 45) do |txt|
|
10
10
|
txt.tspan('Rotation')
|
11
|
-
txt.tspan(' propogates').rotate(20).styles(:
|
12
|
-
tsp.tspan(' to descendents').styles(:
|
11
|
+
txt.tspan(' propogates').rotate(20).styles(fill: 'red') do |tsp|
|
12
|
+
tsp.tspan(' to descendents').styles(fill: 'green')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
canvas.rect(997, 297).styles(:
|
16
|
+
canvas.rect(997, 297).styles(fill: 'none', stroke: 'blue')
|
17
17
|
end
|
18
18
|
|
19
19
|
rvg.draw.write('tspan03.gif')
|
data/doc/ex/unsharp_mask.rb
CHANGED
@@ -11,18 +11,18 @@ img.resize!(3)
|
|
11
11
|
eimg.resize!(3)
|
12
12
|
|
13
13
|
# Make a before-and-after composite
|
14
|
-
eimg.crop!(eimg.columns/2, 0, eimg.columns/2, eimg.rows)
|
14
|
+
eimg.crop!(eimg.columns / 2, 0, eimg.columns / 2, eimg.rows)
|
15
15
|
img = img.composite(eimg, Magick::EastGravity, Magick::OverCompositeOp)
|
16
16
|
|
17
17
|
# Draw a black line between the before and after parts.
|
18
18
|
line = Magick::Draw.new
|
19
|
-
line.line(img.columns/2, 0, img.columns/2, img.rows)
|
19
|
+
line.line(img.columns / 2, 0, img.columns / 2, img.rows)
|
20
20
|
line.draw(img)
|
21
21
|
|
22
22
|
# Zoom in so we can see the change,
|
23
23
|
# then crop everything but the face.
|
24
24
|
img.crop!(Magick::CenterGravity, 250, 200)
|
25
25
|
|
26
|
-
#img.display
|
26
|
+
# img.display
|
27
27
|
img.write('unsharp_mask.jpg')
|
28
28
|
exit
|
data/doc/ex/viewex.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rmagick'
|
4
4
|
|
5
|
-
img = Magick::Image.new(40, 40) {self.background_color = 'lightcyan2'}
|
5
|
+
img = Magick::Image.new(40, 40) { self.background_color = 'lightcyan2' }
|
6
6
|
|
7
7
|
# The view is 400 pixels square, starting
|
8
8
|
# column 10, row 5 from the top of the image.
|
@@ -12,21 +12,21 @@ img.view(10, 5, 20, 20) do |view|
|
|
12
12
|
|
13
13
|
# Change the top and bottom rows to red.
|
14
14
|
view[0][] = 'red'
|
15
|
-
view[-1,1][] = 'red'
|
15
|
+
view[-1, 1][] = 'red'
|
16
16
|
|
17
17
|
# Set 6 pixels to black.
|
18
|
-
view[[13,15]][[12,14,16]] = 'black'
|
18
|
+
view[[13, 15]][[12, 14, 16]] = 'black'
|
19
19
|
|
20
20
|
# Set 1 pixel to yellow.
|
21
21
|
view[5][7] = 'yellow'
|
22
22
|
|
23
23
|
# Change the green channel of all the
|
24
24
|
# pixels on row 8.
|
25
|
-
view[8][].green = Magick::QuantumRange/2
|
25
|
+
view[8][].green = Magick::QuantumRange / 2
|
26
26
|
|
27
27
|
# Change the blue channel of 8 pixels
|
28
28
|
# on column 10.
|
29
|
-
view[4,8][10].blue = Magick::QuantumRange
|
29
|
+
view[4, 8][10].blue = Magick::QuantumRange
|
30
30
|
end
|
31
31
|
|
32
32
|
img.scale(5).write('viewex.gif')
|
data/doc/ex/vignette.rb
CHANGED
File without changes
|
data/doc/ex/watermark.rb
CHANGED
@@ -5,17 +5,17 @@ require 'rmagick'
|
|
5
5
|
img = Magick::Image.read('images/Flower_Hat.jpg').first
|
6
6
|
|
7
7
|
# Make a watermark from the word "RMagick"
|
8
|
-
mark = Magick::Image.new(140, 40) {self.background_color = 'none'}
|
8
|
+
mark = Magick::Image.new(140, 40) { self.background_color = 'none' }
|
9
9
|
gc = Magick::Draw.new
|
10
10
|
|
11
11
|
gc.annotate(mark, 0, 0, 0, -5, 'RMagick') do
|
12
12
|
gc.gravity = Magick::CenterGravity
|
13
13
|
gc.pointsize = 32
|
14
|
-
if RUBY_PLATFORM =~ /mswin32/
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
gc.font_family = if RUBY_PLATFORM =~ /mswin32/
|
15
|
+
'Georgia'
|
16
|
+
else
|
17
|
+
'Times'
|
18
|
+
end
|
19
19
|
gc.fill = 'white'
|
20
20
|
gc.stroke = 'none'
|
21
21
|
end
|
data/doc/ex/wet_floor.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rmagick'
|
|
4
4
|
|
5
5
|
results = Magick::ImageList.new
|
6
6
|
|
7
|
-
img = Magick::Image.new(270, 60) {self.background_color = 'black' }
|
7
|
+
img = Magick::Image.new(270, 60) { self.background_color = 'black' }
|
8
8
|
|
9
9
|
gc = Magick::Draw.new
|
10
10
|
gc.annotate(img, 0, 0, 0, -15, 'RUBY!') do
|
@@ -40,7 +40,7 @@ ilist[1] = img.wet_floor(0.25, 0.5)
|
|
40
40
|
results << ilist.append(true)
|
41
41
|
|
42
42
|
# Add a slant
|
43
|
-
xform = Magick::AffineMatrix.new(1.0, 0.0, Math::PI/4.0, 1.0, 0.0, 0.0)
|
43
|
+
xform = Magick::AffineMatrix.new(1.0, 0.0, Math::PI / 4.0, 1.0, 0.0, 0.0)
|
44
44
|
ilist[1] = ilist[1].affine_transform(xform)
|
45
45
|
results << ilist.append(true)
|
46
46
|
|
data/doc/ex/writing_mode01.rb
CHANGED
@@ -2,25 +2,25 @@ require 'rvg/rvg'
|
|
2
2
|
|
3
3
|
Magick::RVG.dpi = 90
|
4
4
|
|
5
|
-
TEXT_STYLES = {:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
TEXT_STYLES = { writing_mode: 'tb',
|
6
|
+
glyph_orientation_vertical: 0,
|
7
|
+
fill: 'red4',
|
8
|
+
font_weight: 'bold',
|
9
|
+
font_size: 16 }
|
10
10
|
|
11
|
-
TEXT_STYLES2 = {:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
TEXT_STYLES2 = { writing_mode: 'tb',
|
12
|
+
glyph_orientation_vertical: 90,
|
13
|
+
fill: 'green',
|
14
|
+
font_weight: 'bold',
|
15
|
+
font_size: 16 }
|
16
16
|
|
17
|
-
rvg = Magick::RVG.new(1.25.in, 7.in).viewbox(0,0,125,700) do |canvas|
|
17
|
+
rvg = Magick::RVG.new(1.25.in, 7.in).viewbox(0, 0, 125, 700) do |canvas|
|
18
18
|
canvas.background_fill = 'white'
|
19
19
|
|
20
20
|
canvas.text(40, 15, ':glyph_orientation_vertical=0').styles(TEXT_STYLES)
|
21
21
|
canvas.text(80, 25, ':glyph_orientation_vertical=90').styles(TEXT_STYLES2)
|
22
22
|
|
23
|
-
canvas.rect(124, 698).styles(:
|
23
|
+
canvas.rect(124, 698).styles(fill: 'none', stroke: 'blue')
|
24
24
|
end
|
25
25
|
|
26
26
|
rvg.draw.write('writing_mode01.gif')
|
data/doc/ex/writing_mode02.rb
CHANGED
@@ -2,25 +2,25 @@ require 'rvg/rvg'
|
|
2
2
|
|
3
3
|
Magick::RVG.dpi = 90
|
4
4
|
|
5
|
-
TEXT_STYLES = {:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
TEXT_STYLES = { writing_mode: 'lr',
|
6
|
+
glyph_orientation_horizontal: 0,
|
7
|
+
fill: 'red4',
|
8
|
+
font_weight: 'bold',
|
9
|
+
font_size: 16 }
|
10
10
|
|
11
|
-
TEXT_STYLES2 = {:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
TEXT_STYLES2 = { writing_mode: 'lr',
|
12
|
+
glyph_orientation_horizontal: 180,
|
13
|
+
fill: 'green',
|
14
|
+
font_weight: 'bold',
|
15
|
+
font_size: 16 }
|
16
16
|
|
17
|
-
rvg = Magick::RVG.new(3.in, 1.in).viewbox(0,0,300,100) do |canvas|
|
17
|
+
rvg = Magick::RVG.new(3.in, 1.in).viewbox(0, 0, 300, 100) do |canvas|
|
18
18
|
canvas.background_fill = 'white'
|
19
19
|
|
20
20
|
canvas.text(15, 40, ':glyph_orientation_horizontal=0').styles(TEXT_STYLES)
|
21
21
|
canvas.text(15, 80, ':glyph_orientation_horizontal=180').styles(TEXT_STYLES2)
|
22
22
|
|
23
|
-
canvas.rect(299, 99).styles(:
|
23
|
+
canvas.rect(299, 99).styles(fill: 'none', stroke: 'blue')
|
24
24
|
end
|
25
25
|
|
26
26
|
rvg.draw.write('writing_mode02.gif')
|
data/examples/constitute.rb
CHANGED
@@ -2,6 +2,6 @@
|
|
2
2
|
require 'rmagick'
|
3
3
|
|
4
4
|
f = Magick::Image.read('../doc/ex/images/Flower_Hat.jpg').first
|
5
|
-
pixels = f.dispatch(0,0,f.columns, f.rows, 'RGB')
|
5
|
+
pixels = f.dispatch(0, 0, f.columns, f.rows, 'RGB')
|
6
6
|
image = Magick::Image.constitute(f.columns, f.rows, 'RGB', pixels)
|
7
7
|
image.write('constitute.miff')
|
@@ -12,13 +12,13 @@ include Magick
|
|
12
12
|
|
13
13
|
shorts = Image.read('../doc/ex/images/Shorts.jpg').first
|
14
14
|
|
15
|
-
regwidth = shorts.columns/2
|
16
|
-
regheight = shorts.rows/2
|
15
|
+
regwidth = shorts.columns / 2
|
16
|
+
regheight = shorts.rows / 2
|
17
17
|
|
18
|
-
mask = Image.new(regwidth, regheight) { self.background_color = 'white'}
|
18
|
+
mask = Image.new(regwidth, regheight) { self.background_color = 'white' }
|
19
19
|
mask.opacity = 0.50 * TransparentOpacity
|
20
20
|
|
21
|
-
black = Image.new(shorts.columns, shorts.rows) {self.background_color = 'black'}
|
21
|
+
black = Image.new(shorts.columns, shorts.rows) { self.background_color = 'black' }
|
22
22
|
pairs = ImageList.new
|
23
23
|
|
24
24
|
[NorthWestGravity, NorthGravity, NorthEastGravity,
|
@@ -39,4 +39,4 @@ montage = pairs.montage do
|
|
39
39
|
self.border_width = 1
|
40
40
|
end
|
41
41
|
montage.write('crop_with_gravity.miff')
|
42
|
-
#montage.display
|
42
|
+
# montage.display
|
data/examples/demo.rb
CHANGED
@@ -37,7 +37,7 @@ begin
|
|
37
37
|
# optional "size" attribute in the parm block associated with
|
38
38
|
# the read method. There are two more examples of this, below.
|
39
39
|
example = ImageList.new
|
40
|
-
5.times { example.read('NULL:black') { self.size = '70x70'} }
|
40
|
+
5.times { example.read('NULL:black') { self.size = '70x70' } }
|
41
41
|
|
42
42
|
puts ' add noise...'
|
43
43
|
example << model.add_noise(LaplacianNoise)
|
@@ -80,7 +80,7 @@ begin
|
|
80
80
|
example.cur_image[:Label] = 'Contrast'
|
81
81
|
|
82
82
|
puts ' convolve...'
|
83
|
-
kernel = [
|
83
|
+
kernel = [1, 1, 1, 1, 4, 1, 1, 1, 1]
|
84
84
|
example << model.convolve(3, kernel)
|
85
85
|
example.cur_image[:Label] = 'Convolve'
|
86
86
|
|
@@ -100,7 +100,7 @@ begin
|
|
100
100
|
gc.fill_opacity 0
|
101
101
|
gc.stroke 'gold'
|
102
102
|
gc.stroke_width 2
|
103
|
-
gc.circle 60,90, 60,120
|
103
|
+
gc.circle 60, 90, 60, 120
|
104
104
|
gc.draw(example)
|
105
105
|
|
106
106
|
puts ' edge...'
|
@@ -277,7 +277,7 @@ begin
|
|
277
277
|
self.gravity = CenterGravity
|
278
278
|
self.border_width = 1
|
279
279
|
rows = (example.size + 4) / 5
|
280
|
-
self.tile = Geometry.new(5,rows)
|
280
|
+
self.tile = Geometry.new(5, rows)
|
281
281
|
self.compose = OverCompositeOp
|
282
282
|
|
283
283
|
# Use the ImageMagick built-in "granite" format
|
@@ -298,7 +298,7 @@ begin
|
|
298
298
|
puts 'Adding logo image...'
|
299
299
|
logo = Image.read('logo:').first
|
300
300
|
if /GraphicsMagick/.match Magick_version
|
301
|
-
logo.resize!(200.0/logo.rows)
|
301
|
+
logo.resize!(200.0 / logo.rows)
|
302
302
|
else
|
303
303
|
logo.crop!(98, 0, 461, 455).resize!(0.45)
|
304
304
|
end
|
@@ -316,8 +316,7 @@ begin
|
|
316
316
|
# Uncomment the following lines to display image to screen
|
317
317
|
# puts "Displaying image..."
|
318
318
|
# montage_image.display
|
319
|
-
|
320
|
-
rescue
|
319
|
+
rescue StandardError
|
321
320
|
puts "Caught exception: #{$ERROR_INFO}"
|
322
321
|
end
|
323
322
|
|
data/examples/describe.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# Purpose: Demonstrate getting information from the image attributes.
|
3
2
|
# Usage: describe.rb filename1 [filename2...]
|
4
3
|
# Notes: The output is similar to ImageMagick's identify command.
|
@@ -11,7 +10,7 @@ This example shows how to extract attributes from an image.
|
|
11
10
|
|
12
11
|
END_INFO
|
13
12
|
|
14
|
-
if ARGV.length
|
13
|
+
if ARGV.length.zero?
|
15
14
|
puts 'Specify one or more image filenames as arguments.'
|
16
15
|
exit
|
17
16
|
end
|
@@ -31,13 +30,12 @@ ARGV.each do |file|
|
|
31
30
|
puts " Colors: #{img.number_colors}"
|
32
31
|
puts " Filesize: #{img.filesize}"
|
33
32
|
puts " Resolution: #{img.x_resolution.to_i}x#{img.y_resolution.to_i} "\
|
34
|
-
"pixels/#{img.units == Magick::PixelsPerInchResolution ?
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
33
|
+
"pixels/#{img.units == Magick::PixelsPerInchResolution ? 'inch' : 'centimeter'}"
|
34
|
+
|
35
|
+
next if img.properties.empty?
|
36
|
+
|
37
|
+
puts ' Properties:'
|
38
|
+
img.properties do |name, value|
|
39
|
+
puts %( #{name} = "#{value}")
|
42
40
|
end
|
43
41
|
end
|
@@ -16,7 +16,7 @@ begin
|
|
16
16
|
gc.stroke('red')
|
17
17
|
gc.stroke_width(2)
|
18
18
|
gc.fill('none')
|
19
|
-
gc.rectangle(res[0], res[1], res[0]+target.columns, res[1]+target.rows)
|
19
|
+
gc.rectangle(res[0], res[1], res[0] + target.columns, res[1] + target.rows)
|
20
20
|
gc.draw(img)
|
21
21
|
img.matte = false
|
22
22
|
puts "Found similar region. Writing `find_similar_region.gif'..."
|
@@ -25,10 +25,10 @@ begin
|
|
25
25
|
puts 'No match!'
|
26
26
|
end
|
27
27
|
rescue NotImplementedError
|
28
|
-
|
28
|
+
warn <<-END_MSG
|
29
29
|
The find_similar_region method is not supported by this version of
|
30
30
|
ImageMagick/GraphicsMagick.
|
31
|
-
|
31
|
+
END_MSG
|
32
32
|
end
|
33
33
|
|
34
34
|
exit
|
data/examples/histogram.rb
CHANGED
@@ -7,11 +7,11 @@ require 'rmagick'
|
|
7
7
|
class PixelColumn < Array
|
8
8
|
def initialize(size)
|
9
9
|
super
|
10
|
-
fill {Magick::Pixel.new}
|
10
|
+
fill { Magick::Pixel.new }
|
11
11
|
end
|
12
12
|
|
13
13
|
def reset(bg)
|
14
|
-
each {|pixel| pixel.reset(bg)}
|
14
|
+
each { |pixel| pixel.reset(bg) }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -28,250 +28,243 @@ module Magick
|
|
28
28
|
class Image
|
29
29
|
private
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
HISTOGRAM_COLS = 256
|
32
|
+
HISTOGRAM_ROWS = 200
|
33
|
+
MAX_QUANTUM = 255
|
34
|
+
AIR_FACTOR = 1.025
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
# The alpha frequencies are shown as white dots.
|
37
|
+
def alpha_hist(freqs, scale, fg, bg)
|
38
|
+
histogram = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) do
|
39
|
+
self.background_color = bg
|
40
|
+
self.border_color = fg
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
gc = Draw.new
|
44
|
+
gc.affine(1, 0, 0, -scale, 0, HISTOGRAM_ROWS)
|
45
|
+
gc.fill('white')
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
HISTOGRAM_COLS.times do |x|
|
48
|
+
gc.point(x, freqs[x])
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
gc.draw(histogram)
|
52
|
+
histogram['Label'] = 'Alpha'
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
histogram
|
55
|
+
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
88
|
-
if yf >= HISTOGRAM_ROWS - (green[x] * scale)
|
89
|
-
green_column[y].green = QuantumRange
|
90
|
-
green_column[y].red = 0
|
91
|
-
green_column[y].blue = 0
|
92
|
-
rgb_column[y].green = QuantumRange
|
93
|
-
end
|
94
|
-
if yf >= HISTOGRAM_ROWS - (blue[x] * scale)
|
95
|
-
blue_column[y].blue = QuantumRange
|
96
|
-
blue_column[y].red = 0
|
97
|
-
blue_column[y].green = 0
|
98
|
-
rgb_column[y].blue = QuantumRange
|
99
|
-
end
|
100
|
-
if yf >= HISTOGRAM_ROWS - (int[x] * scale)
|
101
|
-
int_column[y].opacity = TransparentOpacity
|
102
|
-
end
|
57
|
+
def channel_histograms(red, green, blue, int, scale, fg, bg)
|
58
|
+
rgb_histogram = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) do
|
59
|
+
self.background_color = bg
|
60
|
+
self.border_color = fg
|
61
|
+
end
|
62
|
+
rgb_histogram['Label'] = 'RGB'
|
63
|
+
red_histogram = rgb_histogram.copy
|
64
|
+
red_histogram['Label'] = 'Red'
|
65
|
+
green_histogram = rgb_histogram.copy
|
66
|
+
green_histogram['Label'] = 'Green'
|
67
|
+
blue_histogram = rgb_histogram.copy
|
68
|
+
blue_histogram['Label'] = 'Blue'
|
69
|
+
int_histogram = rgb_histogram.copy
|
70
|
+
int_histogram['Label'] = 'Intensity'
|
71
|
+
int_histogram.matte = true
|
72
|
+
|
73
|
+
rgb_column = PixelColumn.new(HISTOGRAM_ROWS)
|
74
|
+
red_column = PixelColumn.new(HISTOGRAM_ROWS)
|
75
|
+
green_column = PixelColumn.new(HISTOGRAM_ROWS)
|
76
|
+
blue_column = PixelColumn.new(HISTOGRAM_ROWS)
|
77
|
+
int_column = PixelColumn.new(HISTOGRAM_ROWS)
|
78
|
+
|
79
|
+
HISTOGRAM_COLS.times do |x|
|
80
|
+
HISTOGRAM_ROWS.times do |y|
|
81
|
+
yf = Float(y)
|
82
|
+
if yf >= HISTOGRAM_ROWS - (red[x] * scale)
|
83
|
+
red_column[y].red = QuantumRange
|
84
|
+
red_column[y].green = 0
|
85
|
+
red_column[y].blue = 0
|
86
|
+
rgb_column[y].red = QuantumRange
|
103
87
|
end
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
88
|
+
if yf >= HISTOGRAM_ROWS - (green[x] * scale)
|
89
|
+
green_column[y].green = QuantumRange
|
90
|
+
green_column[y].red = 0
|
91
|
+
green_column[y].blue = 0
|
92
|
+
rgb_column[y].green = QuantumRange
|
93
|
+
end
|
94
|
+
if yf >= HISTOGRAM_ROWS - (blue[x] * scale)
|
95
|
+
blue_column[y].blue = QuantumRange
|
96
|
+
blue_column[y].red = 0
|
97
|
+
blue_column[y].green = 0
|
98
|
+
rgb_column[y].blue = QuantumRange
|
99
|
+
end
|
100
|
+
int_column[y].opacity = TransparentOpacity if yf >= HISTOGRAM_ROWS - (int[x] * scale)
|
115
101
|
end
|
116
102
|
|
117
|
-
|
103
|
+
rgb_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, rgb_column)
|
104
|
+
red_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, red_column)
|
105
|
+
green_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, green_column)
|
106
|
+
blue_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, blue_column)
|
107
|
+
int_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, int_column)
|
108
|
+
rgb_column.reset(bg)
|
109
|
+
red_column.reset(bg)
|
110
|
+
green_column.reset(bg)
|
111
|
+
blue_column.reset(bg)
|
112
|
+
int_column.reset(bg)
|
118
113
|
end
|
119
114
|
|
120
|
-
|
121
|
-
|
122
|
-
img = number_colors > 256 ? quantize(256) : self
|
115
|
+
[red_histogram, green_histogram, blue_histogram, rgb_histogram, int_histogram]
|
116
|
+
end
|
123
117
|
|
124
|
-
|
125
|
-
|
118
|
+
# Make the color histogram. Quantize the image to 256 colors if necessary.
|
119
|
+
def color_hist(fg, bg)
|
120
|
+
img = number_colors > 256 ? quantize(256) : self
|
121
|
+
|
122
|
+
begin
|
123
|
+
hist = img.color_histogram
|
126
124
|
rescue NotImplementedError
|
127
|
-
|
125
|
+
warn 'The color_histogram method is not supported by this version '\
|
128
126
|
'of ImageMagick/GraphicsMagick'
|
127
|
+
else
|
128
|
+
pixels = hist.keys.sort_by { |pixel| hist[pixel] }
|
129
|
+
scale = HISTOGRAM_ROWS / (hist.values.max * AIR_FACTOR)
|
129
130
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
histogram = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) do
|
135
|
-
self.background_color = bg
|
136
|
-
self.border_color = fg
|
137
|
-
end
|
138
|
-
|
139
|
-
x = 0
|
140
|
-
pixels.each do |pixel|
|
141
|
-
column = Array.new(HISTOGRAM_ROWS).fill {Pixel.new}
|
142
|
-
HISTOGRAM_ROWS.times do |y|
|
143
|
-
if y >= HISTOGRAM_ROWS - (hist[pixel] * scale)
|
144
|
-
column[y] = pixel
|
145
|
-
end
|
146
|
-
end
|
147
|
-
histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, column)
|
148
|
-
x = x.succ
|
149
|
-
end
|
131
|
+
histogram = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) do
|
132
|
+
self.background_color = bg
|
133
|
+
self.border_color = fg
|
134
|
+
end
|
150
135
|
|
151
|
-
|
152
|
-
|
136
|
+
x = 0
|
137
|
+
pixels.each do |pixel|
|
138
|
+
column = Array.new(HISTOGRAM_ROWS).fill { Pixel.new }
|
139
|
+
HISTOGRAM_ROWS.times do |y|
|
140
|
+
column[y] = pixel if y >= HISTOGRAM_ROWS - (hist[pixel] * scale)
|
141
|
+
end
|
142
|
+
histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, column)
|
143
|
+
x = x.succ
|
153
144
|
end
|
145
|
+
|
146
|
+
histogram['Label'] = 'Color Frequency'
|
147
|
+
return histogram
|
154
148
|
end
|
149
|
+
end
|
155
150
|
|
156
|
-
|
157
|
-
|
158
|
-
|
151
|
+
# Use AnnotateImage to write the stats.
|
152
|
+
def info_text(fg, bg)
|
153
|
+
klass = class_type == DirectClass ? 'DirectClass' : 'PsuedoClass'
|
159
154
|
|
160
|
-
|
155
|
+
text = <<-END_TEXT
|
161
156
|
Format: #{format}
|
162
157
|
Geometry: #{columns}x#{rows}
|
163
158
|
Class: #{klass}
|
164
159
|
Depth: #{depth} bits-per-pixel component
|
165
160
|
Colors: #{number_colors}
|
166
|
-
|
167
|
-
|
168
|
-
info = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) do
|
169
|
-
self.background_color = bg
|
170
|
-
self.border_color = fg
|
171
|
-
end
|
161
|
+
END_TEXT
|
172
162
|
|
173
|
-
|
163
|
+
info = Image.new(HISTOGRAM_COLS, HISTOGRAM_ROWS) do
|
164
|
+
self.background_color = bg
|
165
|
+
self.border_color = fg
|
166
|
+
end
|
174
167
|
|
175
|
-
|
176
|
-
self.stroke = 'transparent'
|
177
|
-
self.fill = fg
|
178
|
-
self.gravity = CenterGravity
|
179
|
-
end
|
180
|
-
info['Label'] = 'Info'
|
168
|
+
gc = Draw.new
|
181
169
|
|
182
|
-
|
170
|
+
gc.annotate(info, 0, 0, 0, 0, text) do
|
171
|
+
self.stroke = 'transparent'
|
172
|
+
self.fill = fg
|
173
|
+
self.gravity = CenterGravity
|
183
174
|
end
|
175
|
+
info['Label'] = 'Info'
|
184
176
|
|
185
|
-
|
186
|
-
|
187
|
-
int_histogram = gradient.composite(int_histogram, CenterGravity, OverCompositeOp)
|
177
|
+
info
|
178
|
+
end
|
188
179
|
|
189
|
-
|
180
|
+
def intensity_hist(int_histogram)
|
181
|
+
gradient = (Image.read('gradient:#ffff80-#ff9000') { self.size = "#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}" }).first
|
182
|
+
int_histogram = gradient.composite(int_histogram, CenterGravity, OverCompositeOp)
|
190
183
|
|
191
|
-
|
192
|
-
end
|
184
|
+
int_histogram['Label'] = 'Intensity'
|
193
185
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
186
|
+
int_histogram
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns a value between 0 and MAX_QUANTUM. Same as the PixelIntensity macro.
|
190
|
+
def pixel_intensity(pixel)
|
191
|
+
(306 * (pixel.red & MAX_QUANTUM) + 601 * (pixel.green & MAX_QUANTUM) + 117 * (pixel.blue & MAX_QUANTUM)) / 1024
|
192
|
+
end
|
198
193
|
|
199
194
|
public
|
200
195
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
v = pixel_intensity(pixel)
|
221
|
-
int[v] += 1
|
222
|
-
end
|
196
|
+
# Create the histogram montage.
|
197
|
+
def histogram(fg = 'white', bg = 'black')
|
198
|
+
red = Array.new(HISTOGRAM_COLS, 0)
|
199
|
+
green = Array.new(HISTOGRAM_COLS, 0)
|
200
|
+
blue = Array.new(HISTOGRAM_COLS, 0)
|
201
|
+
alpha = Array.new(HISTOGRAM_COLS, 0)
|
202
|
+
int = Array.new(HISTOGRAM_COLS, 0)
|
203
|
+
|
204
|
+
rows.times do |row|
|
205
|
+
pixels = get_pixels(0, row, columns, 1)
|
206
|
+
pixels.each do |pixel|
|
207
|
+
red[pixel.red & MAX_QUANTUM] += 1
|
208
|
+
green[pixel.green & MAX_QUANTUM] += 1
|
209
|
+
blue[pixel.blue & MAX_QUANTUM] += 1
|
210
|
+
|
211
|
+
# Only count opacity channel if some pixels are not opaque.
|
212
|
+
alpha[pixel.opacity & MAX_QUANTUM] += 1 unless opaque?
|
213
|
+
v = pixel_intensity(pixel)
|
214
|
+
int[v] += 1
|
223
215
|
end
|
216
|
+
end
|
224
217
|
|
225
|
-
|
226
|
-
|
227
|
-
|
218
|
+
# Scale to chart size. When computing the scale, add some "air" between
|
219
|
+
# the max frequency and the top of the histogram. This makes a prettier chart.
|
220
|
+
# The RGBA and intensity histograms are all drawn to the same scale.
|
228
221
|
|
229
|
-
|
230
|
-
|
222
|
+
max = [red.max, green.max, blue.max, alpha.max, int.max].max
|
223
|
+
scale = HISTOGRAM_ROWS / (max * AIR_FACTOR)
|
231
224
|
|
232
|
-
|
225
|
+
charts = ImageList.new
|
233
226
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
227
|
+
# Add the thumbnail.
|
228
|
+
thumb = copy
|
229
|
+
thumb['Label'] = File.basename(filename)
|
230
|
+
charts << thumb
|
238
231
|
|
239
|
-
|
240
|
-
|
232
|
+
# Compute the channel and intensity histograms.
|
233
|
+
channel_hists = channel_histograms(red, green, blue, int, scale, fg, bg)
|
241
234
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
235
|
+
# Add the red, green, and blue histograms to the list
|
236
|
+
charts << channel_hists.shift
|
237
|
+
charts << channel_hists.shift
|
238
|
+
charts << channel_hists.shift
|
246
239
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
240
|
+
# Add Alpha channel or image stats
|
241
|
+
charts << if !opaque?
|
242
|
+
alpha_hist(alpha, scale, fg, bg)
|
243
|
+
else
|
244
|
+
info_text(fg, bg)
|
245
|
+
end
|
253
246
|
|
254
|
-
|
255
|
-
|
247
|
+
# Add the RGB histogram
|
248
|
+
charts << channel_hists.shift
|
256
249
|
|
257
|
-
|
258
|
-
|
250
|
+
# Add the intensity histogram.
|
251
|
+
charts << intensity_hist(channel_hists.shift)
|
259
252
|
|
260
|
-
|
261
|
-
|
253
|
+
# Add the color frequency histogram.
|
254
|
+
charts << color_hist(fg, bg)
|
262
255
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
end
|
272
|
-
|
273
|
-
histogram
|
256
|
+
# Make a montage.
|
257
|
+
histogram = charts.montage do
|
258
|
+
self.background_color = bg
|
259
|
+
self.stroke = 'transparent'
|
260
|
+
self.fill = fg
|
261
|
+
self.border_width = 1
|
262
|
+
self.tile = '4x2'
|
263
|
+
self.geometry = "#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}+10+10"
|
274
264
|
end
|
265
|
+
|
266
|
+
histogram
|
267
|
+
end
|
275
268
|
end
|
276
269
|
end
|
277
270
|
|
@@ -292,13 +285,11 @@ end
|
|
292
285
|
|
293
286
|
# Only process first frame if multi-frame image
|
294
287
|
image = Magick::Image.read(filename)
|
295
|
-
if image.length > 1
|
296
|
-
puts 'Charting 1st image'
|
297
|
-
end
|
288
|
+
puts 'Charting 1st image' if image.length > 1
|
298
289
|
image = image.first
|
299
290
|
|
300
291
|
# Give the user something to look at while we're working.
|
301
|
-
name = File.basename(filename).sub(/\..*?$/,'')
|
292
|
+
name = File.basename(filename).sub(/\..*?$/, '')
|
302
293
|
$defout.sync = true
|
303
294
|
printf "Creating #{name}_Histogram.miff"
|
304
295
|
|