rmagick 1.9.0 → 1.9.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 +20 -0
- data/README.html +8 -8
- data/README.txt +6 -6
- data/configure +263 -11
- data/configure.ac +39 -2
- data/doc/constants.html +8 -4
- data/doc/draw.html +0 -4
- data/doc/ex/smile.rb +5 -4
- data/doc/ilist.html +17 -12
- data/doc/image1.html +121 -165
- data/doc/image2.html +185 -65
- data/doc/image3.html +67 -64
- data/doc/imageattrs.html +10 -17
- data/doc/usage.html +6 -12
- data/examples/identify.rb +187 -0
- data/ext/RMagick/MANIFEST +2 -3
- data/ext/RMagick/rmagick.h +6 -2
- data/ext/RMagick/rmagick_config.h.in +5 -0
- data/ext/RMagick/rmilist.c +16 -13
- data/ext/RMagick/rmimage.c +514 -264
- data/ext/RMagick/rmmain.c +25 -5
- data/ext/RMagick/rmutil.c +268 -10
- data/install.rb +5 -2
- data/lib/RMagick.rb +121 -66
- data/rmagick.gemspec +1 -1
- metadata +3 -4
- data/doc/ex/channel_threshold.rb +0 -48
- data/doc/ex/random_channel_threshold.rb +0 -17
data/configure.ac
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# RMagick configure.ac
|
3
3
|
|
4
|
-
AC_INIT(RMagick, 1.9.
|
4
|
+
AC_INIT(RMagick, 1.9.1, rmagick@rubyforge.org, RMagick-1.9.1.tar.gz)
|
5
5
|
echo "Configuring ${PACKAGE_STRING}"
|
6
6
|
|
7
7
|
AC_CONFIG_HEADER([ext/RMagick/rmagick_config.h])
|
@@ -91,7 +91,7 @@ AC_CHECK_FUNCS([GetMagickInfoArray GetColorInfoArray GetLocaleExceptionMessage])
|
|
91
91
|
AC_CHECK_FUNCS([GetMagickGeometry ParseSizeGeometry TintImage GetColorHistogram])
|
92
92
|
AC_CHECK_FUNCS([GetImageHistogram FuzzyColorCompare GetImageProfile GetNextImageProfile])
|
93
93
|
AC_CHECK_FUNCS([GetImageChannelDepth GetImageChannelExtrema GetImageChannelMean])
|
94
|
-
AC_CHECK_FUNCS([CompareImageChannels PreviewImage SetImageColorspace])
|
94
|
+
AC_CHECK_FUNCS([CompareImageChannels PreviewImage SetImageColorspace GetNextImageAttribute])
|
95
95
|
|
96
96
|
# We need to be able to query this later in the configure script, so set a shell variable here
|
97
97
|
# as well as defining a symbol.
|
@@ -197,6 +197,13 @@ AC_CHECK_MEMBERS([Image.quality],,,
|
|
197
197
|
#endif
|
198
198
|
#include "magick/api.h"])
|
199
199
|
|
200
|
+
AC_CHECK_MEMBERS([Image.storage_class],,,
|
201
|
+
[#include <stdio.h>
|
202
|
+
#if HAVE_SYS_TYPES_H
|
203
|
+
#include <sys/types.h>
|
204
|
+
#endif
|
205
|
+
#include "magick/api.h"])
|
206
|
+
|
200
207
|
# Don't use AC_CHECK_MEMBERS!
|
201
208
|
AC_CACHE_CHECK(for Image.extract_info, rm_cv_member_Image_extract_info,
|
202
209
|
AC_TRY_COMPILE([
|
@@ -362,6 +369,21 @@ if test "$rm_cv_enum_indexchannel" = yes; then
|
|
362
369
|
AC_DEFINE(HAVE_INDEXCHANNEL)
|
363
370
|
fi
|
364
371
|
|
372
|
+
AC_CACHE_CHECK(for GrayChannel enum value, rm_cv_enum_graychannel,
|
373
|
+
[AC_TRY_COMPILE(
|
374
|
+
[#include <stdio.h>
|
375
|
+
#if HAVE_SYS_TYPES_H
|
376
|
+
#include <sys/types.h>
|
377
|
+
#endif
|
378
|
+
#include "magick/api.h"],
|
379
|
+
[ChannelType x; x = GrayChannel],
|
380
|
+
rm_cv_enum_graychannel='yes',
|
381
|
+
rm_cv_enum_graychannel='no')])
|
382
|
+
|
383
|
+
if test "$rm_cv_enum_graychannel" = yes; then
|
384
|
+
AC_DEFINE(HAVE_GRAYCHANNEL)
|
385
|
+
fi
|
386
|
+
|
365
387
|
AC_CACHE_CHECK(for AllChannels enum value, rm_cv_enum_allchannels,
|
366
388
|
[AC_TRY_COMPILE(
|
367
389
|
[#include <stdio.h>
|
@@ -407,6 +429,21 @@ if test "$rm_cv_enum_undefinedgravity" = yes; then
|
|
407
429
|
AC_DEFINE(HAVE_UNDEFINEDGRAVITY)
|
408
430
|
fi
|
409
431
|
|
432
|
+
AC_CACHE_CHECK(for QuantumPixel enum value, rm_cv_enum_quantumpixel,
|
433
|
+
[AC_TRY_COMPILE(
|
434
|
+
[#include <stdio.h>
|
435
|
+
#if HAVE_SYS_TYPES_H
|
436
|
+
#include <sys/types.h>
|
437
|
+
#endif
|
438
|
+
#include "magick/api.h"],
|
439
|
+
[GravityType x; x = QuantumPixel],
|
440
|
+
rm_cv_enum_quantumpixel='yes',
|
441
|
+
rm_cv_enum_quantumpixel='no')])
|
442
|
+
|
443
|
+
if test "$rm_cv_enum_quantumpixel" = yes; then
|
444
|
+
AC_DEFINE(HAVE_QUANTUMPIXEL)
|
445
|
+
fi
|
446
|
+
|
410
447
|
if test "$rm_have_getimagequantumdepth" = yes; then
|
411
448
|
# IM 6.0.5 changed the number of arguments to GetImageQuantumDepth.
|
412
449
|
AC_CACHE_CHECK(if GetImageQuantumDepth has only 1 argument, rm_cv_args_get_image_quantum_depth,
|
data/doc/constants.html
CHANGED
@@ -105,7 +105,7 @@
|
|
105
105
|
|
106
106
|
<li><a href="#EndianType">EndianType</a></li>
|
107
107
|
|
108
|
-
<li><a href="#
|
108
|
+
<li><a href="#FilterTypes">FilterTypes</a></li>
|
109
109
|
|
110
110
|
<li><a href="#GravityType">GravityType</a></li>
|
111
111
|
|
@@ -148,7 +148,7 @@
|
|
148
148
|
|
149
149
|
<dd>An extended form of the <code>Version</code> constant with
|
150
150
|
the format shown here:<br />
|
151
|
-
<code>This is RMagick 1.4.0 ($Date: 2005/
|
151
|
+
<code>This is RMagick 1.4.0 ($Date: 2005/07/31 14:57:29 $)
|
152
152
|
Copyright (C) 2005 by Timothy P. Hunter<br />
|
153
153
|
Built with ImageMagick 6.0.0 02/25/04 Q8
|
154
154
|
http://www.imagemagick.org<br />
|
@@ -245,6 +245,8 @@
|
|
245
245
|
|
246
246
|
<dt>BlueChannel</dt>
|
247
247
|
|
248
|
+
<dt>CyanChannel</dt>
|
249
|
+
|
248
250
|
<dt>MagentaChannel</dt>
|
249
251
|
|
250
252
|
<dt>YellowChannel</dt>
|
@@ -254,6 +256,8 @@
|
|
254
256
|
<dt>OpacityChannel</dt>
|
255
257
|
|
256
258
|
<dt>AllChannels</dt>
|
259
|
+
|
260
|
+
<dt>GrayChannel</dt>
|
257
261
|
</dl>
|
258
262
|
|
259
263
|
<h3 class="const" id="ClassType">ClassType</h3>
|
@@ -721,7 +725,7 @@
|
|
721
725
|
|
722
726
|
<dd class="imquote">Lempel-Ziv-Welch (LZW) compression</dd>
|
723
727
|
|
724
|
-
<dt>
|
728
|
+
<dt>RLECompression</dt>
|
725
729
|
|
726
730
|
<dd>See the Wikipedia page for <a href=
|
727
731
|
"http://en.wikipedia.org/wiki/Run_length_encoding">Run-length
|
@@ -794,7 +798,7 @@
|
|
794
798
|
<dt>MSBEndian</dt>
|
795
799
|
</dl>
|
796
800
|
|
797
|
-
<h3 class="const" id="
|
801
|
+
<h3 class="const" id="FilterTypes">FilterTypes</h3>
|
798
802
|
|
799
803
|
<p><span class="imquote">Used to adjust the filter algorithm used
|
800
804
|
when resizing images. Different filters experience varying
|
data/doc/draw.html
CHANGED
@@ -2525,10 +2525,6 @@ draw.stroke_opacity('40%')
|
|
2525
2525
|
"text_antialias">text_antialias</a>, and <a href=
|
2526
2526
|
"text_undercolor">text_undercolor</a> methods.</p>
|
2527
2527
|
|
2528
|
-
<p>You can embed information about the image by including
|
2529
|
-
<a href="#spec_chars_table">special character sequences</a> in
|
2530
|
-
the text string.</p>
|
2531
|
-
|
2532
2528
|
<p>Generally it is a good idea to surround the text string with
|
2533
2529
|
quotes (""), apostrophes (''), or braces ({}). If the text
|
2534
2530
|
string starts with a digit or contains an embedded blank,
|
data/doc/ex/smile.rb
CHANGED
@@ -108,12 +108,13 @@ SmileBits = [
|
|
108
108
|
q << Magick::Pixel.new(0,0,0,0)
|
109
109
|
end
|
110
110
|
|
111
|
+
n = 0
|
111
112
|
SmileHeight.times do |y| # Store pixels a row at a time
|
112
113
|
SmileWidth.times do |x| # Build a row of pixels
|
113
|
-
q[x].red = MaxRGB * SmileBits
|
114
|
-
q[x].green = MaxRGB * SmileBits
|
115
|
-
q[x].blue = MaxRGB * SmileBits
|
116
|
-
|
114
|
+
q[x].red = MaxRGB * SmileBits[n]
|
115
|
+
q[x].green = MaxRGB * SmileBits[n]
|
116
|
+
q[x].blue = MaxRGB * SmileBits[n]
|
117
|
+
n += 1
|
117
118
|
end
|
118
119
|
# Store the row of pixels
|
119
120
|
img.store_pixels(0, y, SmileWidth, 1, q)
|
data/doc/ilist.html
CHANGED
@@ -798,14 +798,17 @@ imagelist2 = imagelist1.copy
|
|
798
798
|
|
799
799
|
<h4>Arguments</h4>
|
800
800
|
|
801
|
-
<p>
|
802
|
-
|
803
|
-
|
801
|
+
<p>A <em>blob</em> can be a string containing an image file
|
802
|
+
such as a JPEG or GIF. The string can contain a multi-image file such
|
803
|
+
as an animated GIF or a Photoshop image with multiple layers. A blob
|
804
|
+
can also be one of the strings produced by <a href=
|
805
|
+
"#to_blob">to_blob</a>. Control how the image(s) are created
|
806
|
+
by setting additional <a href=
|
804
807
|
"info.html">Image::Info</a> attributes in the optional block
|
805
808
|
argument. Useful attributes include <a href=
|
806
|
-
"info.html#
|
807
|
-
"info.html#
|
808
|
-
"info.html#
|
809
|
+
"info.html#scene">scene</a>, <a href=
|
810
|
+
"info.html#number_scenes">number_scenes</a>, and
|
811
|
+
<a href="info.html#extract">extract</a>.</p>
|
809
812
|
|
810
813
|
<h4>Returns</h4>
|
811
814
|
|
@@ -815,12 +818,14 @@ imagelist2 = imagelist1.copy
|
|
815
818
|
|
816
819
|
<h4>Example</h4>
|
817
820
|
<pre>
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
821
|
+
require 'RMagick'
|
822
|
+
|
823
|
+
f = File.open('Cheetah.jpg')
|
824
|
+
blob = f.read
|
825
|
+
|
826
|
+
ilist = Magick::ImageList.new
|
827
|
+
ilist.from_blob(blob)
|
828
|
+
ilist.display
|
824
829
|
</pre>
|
825
830
|
|
826
831
|
<h4>See also</h4><a href="#to_blob">to_blob</a>, <a href=
|
data/doc/image1.html
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
3
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
5
|
<head>
|
6
6
|
<meta name="generator" content=
|
7
|
-
"HTML Tidy for
|
7
|
+
"HTML Tidy for Mac OS X (vers 1st September 2004), see www.w3.org" />
|
8
8
|
|
9
9
|
<title>RMagick: class Image (class and instance methods, part
|
10
10
|
1)</title>
|
@@ -17,34 +17,33 @@
|
|
17
17
|
<script type="text/javascript" src="scripts/doc.js">
|
18
18
|
</script>
|
19
19
|
<script type="text/javascript">
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
//]]>
|
20
|
+
//<![CDATA[
|
21
|
+
<!-- Pre-load this image so that the browser knows how big it is. -->
|
22
|
+
flower_hat = new Image();
|
23
|
+
flower_hat.src = "ex/images/Flower_Hat.jpg";
|
24
|
+
function show_noise(type)
|
25
|
+
{
|
26
|
+
if (type == null)
|
27
|
+
{
|
28
|
+
document.getElementById("add_noise_example").src = "ex/images/Flower_Hat.jpg";
|
29
|
+
}
|
30
|
+
else
|
31
|
+
{
|
32
|
+
document.getElementById("add_noise_example").src = "ex/add_noise_" + type + ".jpg";
|
33
|
+
}
|
34
|
+
}
|
35
|
+
//]]>
|
37
36
|
</script>
|
38
37
|
<style type="text/css">
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
38
|
+
/*<![CDATA[*/
|
39
|
+
.noise_example_wrapper img {
|
40
|
+
float: left;
|
41
|
+
}
|
42
|
+
.noise_example_wrapper p, .noise_example_wrapper ul {
|
43
|
+
margin-left: 4px;
|
44
|
+
float: left;
|
45
|
+
}
|
46
|
+
/*]]>*/
|
48
47
|
</style>
|
49
48
|
</head>
|
50
49
|
|
@@ -130,9 +129,6 @@
|
|
130
129
|
|
131
130
|
<li><a href="#channel_mean">channel_mean</a></li>
|
132
131
|
|
133
|
-
<li><a href=
|
134
|
-
"#channel_threshold">channel_threshold</a></li>
|
135
|
-
|
136
132
|
<li><a href="#charcoal">charcoal</a></li>
|
137
133
|
|
138
134
|
<li><a href="#chop">chop</a></li>
|
@@ -285,8 +281,8 @@
|
|
285
281
|
<h4>Example</h4>
|
286
282
|
<pre>
|
287
283
|
img = Magick::Image.capture {
|
288
|
-
|
289
|
-
|
284
|
+
self.filename = "root"
|
285
|
+
}
|
290
286
|
</pre>
|
291
287
|
</div>
|
292
288
|
|
@@ -372,8 +368,12 @@ img = Magick::Image.capture {
|
|
372
368
|
|
373
369
|
<h4>Arguments</h4>
|
374
370
|
|
375
|
-
<p>A string
|
376
|
-
|
371
|
+
<p>A blob can be a string containing an image file such as
|
372
|
+
a JPEG or GIF. The string can contain a multi-image file
|
373
|
+
such as an animated GIF or a Photoshop image with multiple
|
374
|
+
layers. A blob can also be one of the strings produced by
|
375
|
+
<a href="image3.html" target="to_blob">to_blob</a>. Control
|
376
|
+
the format of the created image(s) by setting
|
377
377
|
additional <a href="info.html">Image::Info</a> attributes in
|
378
378
|
the optional block argument.</p>
|
379
379
|
|
@@ -433,8 +433,8 @@ img = Magick::Image.capture {
|
|
433
433
|
<h4>Example</h4>
|
434
434
|
<pre>
|
435
435
|
img = Magick::Image.new(256, 64) {
|
436
|
-
|
437
|
-
|
436
|
+
self.background_color = 'red'
|
437
|
+
}
|
438
438
|
</pre>
|
439
439
|
|
440
440
|
<h4>See also</h4>
|
@@ -478,8 +478,8 @@ img = Magick::Image.new(256, 64) {
|
|
478
478
|
<h4>Example</h4>
|
479
479
|
<pre>
|
480
480
|
cheetah = Magick::Image.ping("Cheetah.jpg") »
|
481
|
-
|
482
|
-
p cheetah[0].rows
|
481
|
+
[Cheetah.jpg JPEG 1024x768 DirectClass 8-bit 101684b]
|
482
|
+
p cheetah[0].rows » 768
|
483
483
|
p cheetah[0].columns » 1024
|
484
484
|
</pre>
|
485
485
|
|
@@ -608,13 +608,13 @@ img = Magick::Image.read_inline(content)
|
|
608
608
|
|
609
609
|
<h4>Example</h4>
|
610
610
|
<pre>
|
611
|
-
|
611
|
+
mom['Label'] = 'My Mother'
|
612
612
|
</pre>
|
613
613
|
|
614
614
|
<h4>See also</h4>
|
615
615
|
|
616
616
|
<p><a href="#aset"><code>[ ]=</code></a>, <a href=
|
617
|
-
"
|
617
|
+
"image3.html#properties"><code>properties</code></a></p>
|
618
618
|
|
619
619
|
<h4>Magick API</h4>
|
620
620
|
|
@@ -653,7 +653,7 @@ img = Magick::Image.read_inline(content)
|
|
653
653
|
<h4>See also</h4>
|
654
654
|
|
655
655
|
<p><a href="#aref">[<code> ]</code></a>, <a href=
|
656
|
-
"
|
656
|
+
"image3.html#properties"><code>properties</code></a></p>
|
657
657
|
|
658
658
|
<h4>Magick API</h4>
|
659
659
|
|
@@ -751,14 +751,13 @@ img = Magick::Image.read_inline(content)
|
|
751
751
|
|
752
752
|
<h4>See also</h4>
|
753
753
|
|
754
|
-
<p><a href="#
|
755
|
-
"image3.html#
|
754
|
+
<p><a href="#bilevel_channel">bilevel_channel</a>, <a href=
|
755
|
+
"image3.html#random_threshold_channel">random_threshold_channel</a>,
|
756
756
|
<a href="image3.html#threshold">threshold</a></p>
|
757
757
|
|
758
758
|
<h4>Magick API</h4>
|
759
759
|
|
760
|
-
<p>AdaptiveThresholdImage
|
761
|
-
later)</p>
|
760
|
+
<p>AdaptiveThresholdImage</p>
|
762
761
|
</div>
|
763
762
|
|
764
763
|
<div class="sig">
|
@@ -790,7 +789,7 @@ img = Magick::Image.read_inline(content)
|
|
790
789
|
<a href="javascript:popup('add_noise.rb.html')"><img src=
|
791
790
|
"ex/images/Flower_Hat.jpg" alt="add_noise example" id=
|
792
791
|
"add_noise_example" title="Click to see the example script"
|
793
|
-
|
792
|
+
/></a>
|
794
793
|
|
795
794
|
<p>Click the NoiseType to see the effect.</p>
|
796
795
|
|
@@ -817,7 +816,7 @@ img = Magick::Image.read_inline(content)
|
|
817
816
|
</ul>
|
818
817
|
</div>
|
819
818
|
|
820
|
-
<div style="clear:both"></div>
|
819
|
+
<div style="clear: both;"></div>
|
821
820
|
|
822
821
|
<h4>Magick API</h4>
|
823
822
|
|
@@ -863,7 +862,7 @@ img = Magick::Image.read_inline(content)
|
|
863
862
|
onmouseout="this.src='ex/affine_transform.jpg'" src=
|
864
863
|
"ex/affine_transform.jpg" alt="affine_transform example" title=
|
865
864
|
"Click to see the example script" /></a> <img src=
|
866
|
-
"ex/images/spin.gif" alt="" class="spin" style="left:237px;"
|
865
|
+
"ex/images/spin.gif" alt="" class="spin" style="left: 237px;"
|
867
866
|
title="Mouse over the example to see the original image" /></p>
|
868
867
|
|
869
868
|
<h4>See also</h4>
|
@@ -948,9 +947,17 @@ img = Magick::Image.read_inline(content)
|
|
948
947
|
"ex/images/spin.gif" alt="" class="spin" title=
|
949
948
|
"Mouse over the example to see the original image" /></p>
|
950
949
|
|
950
|
+
<h4>See also</h4>
|
951
|
+
|
952
|
+
<p><a href="#adaptive_threshold">adaptive_threshold</a>,
|
953
|
+
<a href="image3.html#random_threshold_channel">
|
954
|
+
random_threshold_channel</a></p>
|
955
|
+
|
956
|
+
|
957
|
+
|
951
958
|
<h4>Magick API</h4>
|
952
959
|
|
953
|
-
<p>BilevelImageChannel
|
960
|
+
<p>BilevelImageChannel</p>
|
954
961
|
</div>
|
955
962
|
|
956
963
|
<div class="sig">
|
@@ -1089,12 +1096,11 @@ img = Magick::Image.read_inline(content)
|
|
1089
1096
|
<h4>See also</h4>
|
1090
1097
|
|
1091
1098
|
<p><a href="image3.html#white_threshold">white_threshold</a>,
|
1092
|
-
<a href="#
|
1099
|
+
<a href="#bilevel_channel">bilevel_channel</a></p>
|
1093
1100
|
|
1094
1101
|
<h4>Magick API</h4>
|
1095
1102
|
|
1096
|
-
<p>BlackThresholdImage
|
1097
|
-
GraphicsMagick 1.1)</p>
|
1103
|
+
<p>BlackThresholdImage</p>
|
1098
1104
|
</div>
|
1099
1105
|
|
1100
1106
|
<div class="sig">
|
@@ -1136,15 +1142,15 @@ img = Magick::Image.read_inline(content)
|
|
1136
1142
|
|
1137
1143
|
<p class="rollover"><a href=
|
1138
1144
|
"javascript:popup('border.rb.html')"><img style=
|
1139
|
-
"padding:10px; display:none" id="borderless" onmouseout=
|
1145
|
+
"padding: 10px; display: none;" id="borderless" onmouseout=
|
1140
1146
|
"this.style.display='none'; bordered.style.display='';" src=
|
1141
1147
|
"ex/images/Flower_Hat.jpg" alt="border example" title=
|
1142
|
-
"Click to see the example script"
|
1148
|
+
"Click to see the example script" /> <img id=
|
1143
1149
|
"bordered" onmouseover=
|
1144
1150
|
"this.style.display='none'; borderless.style.display='';" src=
|
1145
|
-
"ex/border.jpg" alt="border example"
|
1146
|
-
|
1147
|
-
"left: 224px;" title=
|
1151
|
+
"ex/border.jpg" alt="border example" /></a><img
|
1152
|
+
src="ex/images/spin.gif" alt="" class=
|
1153
|
+
"spin" style="left: 224px;" title=
|
1148
1154
|
"Mouse over the example to see the original image" /></p>
|
1149
1155
|
|
1150
1156
|
<h4>See also</h4>
|
@@ -1214,8 +1220,8 @@ img = Magick::Image.read_inline(content)
|
|
1214
1220
|
<pre>
|
1215
1221
|
mona = Magick::Image.read('MonaLisa.jpg').first
|
1216
1222
|
mona.change_geometry!('320x240') { |cols, rows, img|
|
1217
|
-
|
1218
|
-
|
1223
|
+
img.resize!(cols, rows)
|
1224
|
+
}
|
1219
1225
|
</pre>
|
1220
1226
|
|
1221
1227
|
<h4>Magick API</h4>
|
@@ -1321,7 +1327,7 @@ mona.change_geometry!('320x240') { |cols, rows, img|
|
|
1321
1327
|
|
1322
1328
|
<h4>Magick API</h4>
|
1323
1329
|
|
1324
|
-
<p>GetImageChannelDepth
|
1330
|
+
<p>GetImageChannelDepth</p>
|
1325
1331
|
</div>
|
1326
1332
|
|
1327
1333
|
<div class="sig">
|
@@ -1363,7 +1369,7 @@ mona.change_geometry!('320x240') { |cols, rows, img|
|
|
1363
1369
|
|
1364
1370
|
<h4>Magick API</h4>
|
1365
1371
|
|
1366
|
-
<p>GetImageChannelExtrema (available in ImageMagick
|
1372
|
+
<p>GetImageChannelExtrema (available in ImageMagick),
|
1367
1373
|
GetImageStatistics (available in GraphicsMagick 1.1)</p>
|
1368
1374
|
</div>
|
1369
1375
|
|
@@ -1406,63 +1412,10 @@ mona.change_geometry!('320x240') { |cols, rows, img|
|
|
1406
1412
|
|
1407
1413
|
<h4>Magick API</h4>
|
1408
1414
|
|
1409
|
-
<p>GetImageChannelMean (available in ImageMagick
|
1415
|
+
<p>GetImageChannelMean (available in ImageMagick),
|
1410
1416
|
GetImageStatistics (available in GraphicsMagick 1.1)</p>
|
1411
1417
|
</div>
|
1412
1418
|
|
1413
|
-
<div class="sig">
|
1414
|
-
<h3 id="channel_threshold">channel_threshold</h3>
|
1415
|
-
|
1416
|
-
<p><span class=
|
1417
|
-
"arg">image</span>.channel_threshold(<span class="arg">red_channel</span>,
|
1418
|
-
[<span class="arg">green_channel</span>[, <span class=
|
1419
|
-
"arg">blue_channel</span>[, <span class=
|
1420
|
-
"arg">opacity_channel</span>]]]) -> <em>anImage</em></p>
|
1421
|
-
</div>
|
1422
|
-
|
1423
|
-
<div class="desc">
|
1424
|
-
<h4>Description</h4>
|
1425
|
-
|
1426
|
-
<p>Creates a high-contrast image by changing the pixels based
|
1427
|
-
on the intensity of each pixel channel.</p>
|
1428
|
-
|
1429
|
-
<h4>Arguments</h4>Each channel argument is a number between 0
|
1430
|
-
and MaxRGB. All arguments except the first may be omitted. If
|
1431
|
-
the <span class="arg">green_channel</span> or <span class=
|
1432
|
-
"arg">blue_channel</span> argument is omitted, the default
|
1433
|
-
value is the <span class="arg">red_channel</span> value. If the
|
1434
|
-
<span class="arg">opacity_channel</span> argument is omitted,
|
1435
|
-
the default value is <a href=
|
1436
|
-
"constants.html#Opacity">OpaqueOpacity</a>.
|
1437
|
-
|
1438
|
-
<h4>Returns</h4>
|
1439
|
-
|
1440
|
-
<p>A new image</p>
|
1441
|
-
|
1442
|
-
<h4>Example</h4>
|
1443
|
-
|
1444
|
-
<p class="rollover"><a href=
|
1445
|
-
"javascript:popup('channel_threshold.rb.html')"><img onmouseover="this.src='ex/channel_threshold_before.jpg'"
|
1446
|
-
onmouseout="this.src='ex/channel_threshold_after.jpg'" src=
|
1447
|
-
"ex/channel_threshold_after.jpg" alt=
|
1448
|
-
"channel_threshold example" title=
|
1449
|
-
"Click the image to see the example script" /></a> <img src=
|
1450
|
-
"ex/images/spin.gif" alt="" class="spin" style="left: 446px"
|
1451
|
-
title="Mouse over the example to see the original image" /></p>
|
1452
|
-
|
1453
|
-
<h4>See also</h4>
|
1454
|
-
|
1455
|
-
<p><a href="#adaptive_threshold">adaptive_threshold</a>,
|
1456
|
-
<a href="#black_threshold">black_threshold</a>, <a href=
|
1457
|
-
"image3.html#random_channel_threshold">random_channel_threshold</a>,
|
1458
|
-
<a href="image3.html#threshold">threshold</a>, <a href=
|
1459
|
-
"image3.html#white_threshold">white_threshold</a></p>
|
1460
|
-
|
1461
|
-
<h4>Magick API</h4>
|
1462
|
-
|
1463
|
-
<p>ThresholdImageChannel</p>
|
1464
|
-
</div>
|
1465
|
-
|
1466
1419
|
<div class="sig">
|
1467
1420
|
<h3 id="charcoal">charcoal</h3>
|
1468
1421
|
|
@@ -1752,7 +1705,7 @@ mona.change_geometry!('320x240') { |cols, rows, img|
|
|
1752
1705
|
|
1753
1706
|
<h4>Magick API</h4>GetColorHistogram (available in
|
1754
1707
|
GraphicsMagick 1.1), GetImageHistogram (available in
|
1755
|
-
ImageMagick
|
1708
|
+
ImageMagick)
|
1756
1709
|
</div>
|
1757
1710
|
|
1758
1711
|
<div class="sig">
|
@@ -1966,8 +1919,9 @@ f.color_reset!(red)
|
|
1966
1919
|
The desired distortion metric. One of the following
|
1967
1920
|
constants:
|
1968
1921
|
|
1969
|
-
<ul style=
|
1970
|
-
|
1922
|
+
<ul style=
|
1923
|
+
"list-style-type: none; list-style-image: none; list-style-position: outside;">
|
1924
|
+
<li>MeanAbsoluteErrorMetric</li>
|
1971
1925
|
|
1972
1926
|
<li>MeanSquaredErrorMetric</li>
|
1973
1927
|
|
@@ -2001,7 +1955,7 @@ f.color_reset!(red)
|
|
2001
1955
|
|
2002
1956
|
<h4>Magick API</h4>
|
2003
1957
|
|
2004
|
-
<p>ImageCompareChannels
|
1958
|
+
<p>ImageCompareChannels</p>
|
2005
1959
|
|
2006
1960
|
<h4>Notes</h4>
|
2007
1961
|
|
@@ -2038,7 +1992,7 @@ f.color_reset!(red)
|
|
2038
1992
|
<p>The composite method can be called three different ways:</p>
|
2039
1993
|
|
2040
1994
|
<dl>
|
2041
|
-
<dt style="font-style:normal">1. Without a gravity
|
1995
|
+
<dt style="font-style: normal;">1. Without a gravity
|
2042
1996
|
argument:</dt>
|
2043
1997
|
|
2044
1998
|
<dd>
|
@@ -2061,7 +2015,7 @@ f.color_reset!(red)
|
|
2061
2015
|
</dl>
|
2062
2016
|
</dd>
|
2063
2017
|
|
2064
|
-
<dt style="font-style:normal">2. With a gravity
|
2018
|
+
<dt style="font-style: normal;">2. With a gravity
|
2065
2019
|
argument, without x and y arguments:</dt>
|
2066
2020
|
|
2067
2021
|
<dd>
|
@@ -2134,8 +2088,8 @@ f.color_reset!(red)
|
|
2134
2088
|
</dl>
|
2135
2089
|
</dd>
|
2136
2090
|
|
2137
|
-
<dt style="font-style:normal">3. With gravity, x, and
|
2138
|
-
arguments:</dt>
|
2091
|
+
<dt style="font-style: normal;">3. With gravity, x, and
|
2092
|
+
y arguments:</dt>
|
2139
2093
|
|
2140
2094
|
<dd>
|
2141
2095
|
<dl>
|
@@ -2270,17 +2224,19 @@ f.color_reset!(red)
|
|
2270
2224
|
|
2271
2225
|
<p>Removes duplicate or unused entries in the colormap. Only
|
2272
2226
|
<a href="constants.html#ClassType">PseudoClass</a> images have
|
2273
|
-
a colormap
|
2227
|
+
a colormap. If the image is <code>DirectClass</code> then
|
2228
|
+
<code>compress_colormap!</code> converts it to <code>
|
2229
|
+
PseudoClass</code>.</p>
|
2274
2230
|
|
2275
2231
|
<h4>Returns</h4>self
|
2276
2232
|
|
2277
2233
|
<h4>Example</h4>
|
2278
2234
|
<pre>
|
2279
2235
|
f = Magick::Image.read('cbezier1.gif').first »
|
2280
|
-
|
2236
|
+
cbezier1.gif GIF 500x350+0+0 PseudoClass 128c 8-bit 177503b
|
2281
2237
|
f.colors » 128
|
2282
2238
|
f.compress_colormap! »
|
2283
|
-
|
2239
|
+
cbezier1.gif GIF 500x350+0+0 PseudoClass 108c 8-bit 177503b
|
2284
2240
|
f.colors » 108
|
2285
2241
|
</pre>
|
2286
2242
|
|
@@ -2425,7 +2381,7 @@ f.colors » 108
|
|
2425
2381
|
|
2426
2382
|
<h4>Magick API</h4>
|
2427
2383
|
|
2428
|
-
<p>ConvolveImageChannel
|
2384
|
+
<p>ConvolveImageChannel</p>
|
2429
2385
|
|
2430
2386
|
<h4>See also</h4>
|
2431
2387
|
|
@@ -2475,15 +2431,16 @@ f2 = f.copy
|
|
2475
2431
|
</div>
|
2476
2432
|
|
2477
2433
|
<div class="desc">
|
2478
|
-
<h4>Description</h4>
|
2479
|
-
|
2434
|
+
<h4>Description</h4>
|
2435
|
+
|
2436
|
+
<p>Extracts the specified rectangle from the image.</p>
|
2480
2437
|
|
2481
2438
|
<h4>Arguments</h4>
|
2482
2439
|
|
2483
2440
|
<p>The crop method can be called three different ways:</p>
|
2484
2441
|
|
2485
2442
|
<dl>
|
2486
|
-
<dt style="font-style:normal">1. Without a
|
2443
|
+
<dt style="font-style: normal;">1. Without a
|
2487
2444
|
<em>gravity</em> argument:</dt>
|
2488
2445
|
|
2489
2446
|
<dd>
|
@@ -2500,9 +2457,9 @@ f2 = f.copy
|
|
2500
2457
|
</dl>
|
2501
2458
|
</dd>
|
2502
2459
|
|
2503
|
-
<dt style="font-style:normal">2. With a
|
2504
|
-
argument, but without <em>x</em> and
|
2505
|
-
arguments:</dt>
|
2460
|
+
<dt style="font-style: normal;">2. With a
|
2461
|
+
<em>gravity</em> argument, but without <em>x</em> and
|
2462
|
+
<em>y</em> arguments:</dt>
|
2506
2463
|
|
2507
2464
|
<dd>
|
2508
2465
|
<dl>
|
@@ -2566,8 +2523,8 @@ f2 = f.copy
|
|
2566
2523
|
</dl>
|
2567
2524
|
</dd>
|
2568
2525
|
|
2569
|
-
<dt style="font-style:normal">3. With
|
2570
|
-
<em>x</em>, and <em>y</em> arguments:</dt>
|
2526
|
+
<dt style="font-style: normal;">3. With
|
2527
|
+
<em>gravity</em>, <em>x</em>, and <em>y</em> arguments:</dt>
|
2571
2528
|
|
2572
2529
|
<dd>
|
2573
2530
|
<dl>
|
@@ -2597,6 +2554,20 @@ f2 = f.copy
|
|
2597
2554
|
</dd>
|
2598
2555
|
</dl>
|
2599
2556
|
|
2557
|
+
<h4>Notes</h4>The <code>crop</code> method retains the offset
|
2558
|
+
information in the cropped image. This may cause the image to
|
2559
|
+
appear to be surrounded by blank or black space when viewed
|
2560
|
+
with an external viewer. This only occurs when the image is
|
2561
|
+
saved in a format (such as GIF) that saves offset information.
|
2562
|
+
To reset the offset data, add <code>true</code> as the last
|
2563
|
+
argument to <code>crop</code>. For example,
|
2564
|
+
<pre>
|
2565
|
+
cropped = img.crop(x, y, width, height, true)
|
2566
|
+
</pre>
|
2567
|
+
|
2568
|
+
<p>You can add <code>true</code> as the last argument with any
|
2569
|
+
of the three argument list formats described above.</p>
|
2570
|
+
|
2600
2571
|
<h4>Returns</h4>
|
2601
2572
|
|
2602
2573
|
<p>A new image</p>
|
@@ -2623,23 +2594,6 @@ f2 = f.copy
|
|
2623
2594
|
|
2624
2595
|
<p><a href="#crop_bang">crop!</a>, <a href="#chop">chop</a></p>
|
2625
2596
|
|
2626
|
-
<h4>Notes</h4>
|
2627
|
-
|
2628
|
-
<p>In very recent versions of ImageMagick (6.1.x and later) the
|
2629
|
-
image retains the <em>x-</em> and <em>y-</em>offsets in its
|
2630
|
-
<a href="imageattrs.html#page">page</a> attribute after
|
2631
|
-
cropping. This may cause the cropped image to be displayed by
|
2632
|
-
external viewers (the GIMP, for example) with invisible left
|
2633
|
-
and top borders. You can set the <em>x-</em> and
|
2634
|
-
<em>y-</em>offsets to 0 by changing the <code>page</code>
|
2635
|
-
attribute to a new <a href=
|
2636
|
-
"struct.html#Rectangle">rectangle</a>. For example:</p>
|
2637
|
-
<pre>
|
2638
|
-
img.crop!(x, y, width, height)
|
2639
|
-
img.page = Rectangle.new(width, height, 0, 0)
|
2640
|
-
|
2641
|
-
</pre>
|
2642
|
-
|
2643
2597
|
<h4>Magick API</h4>
|
2644
2598
|
|
2645
2599
|
<p>CropImage</p>
|
@@ -2683,6 +2637,9 @@ f2 = f.copy
|
|
2683
2637
|
<p class="imquote">Displaces the colormap by a given number of
|
2684
2638
|
positions. If you cycle the colormap a number of times you can
|
2685
2639
|
produce a psychedelic effect.</p>
|
2640
|
+
|
2641
|
+
<p>The returned image is always a <code>PseudoClass</code> image,
|
2642
|
+
regardless of the type of the original image.</p>
|
2686
2643
|
|
2687
2644
|
<h4>Arguments</h4>
|
2688
2645
|
|
@@ -2704,7 +2661,7 @@ f2 = f.copy
|
|
2704
2661
|
"ex/images/Hot_Air_Balloons.jpg" alt="cycle_colormap example"
|
2705
2662
|
title=
|
2706
2663
|
"Click the image to see the example script" /></a><img src=
|
2707
|
-
"ex/images/spin.gif" alt="" class="spin" style="left: 191px"
|
2664
|
+
"ex/images/spin.gif" alt="" class="spin" style="left: 191px;"
|
2708
2665
|
title="Mouse over the example to see the animation" /></p>
|
2709
2666
|
|
2710
2667
|
<h4>Magick API</h4>
|
@@ -2854,13 +2811,13 @@ pixels = f.dispatch(0,0,f.columns,f.rows,"RGB")
|
|
2854
2811
|
# Write the pixels to a file, to be included
|
2855
2812
|
# in the constitute.rb example.
|
2856
2813
|
File.open('pixels-array', 'w') { |txt|
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2814
|
+
txt.puts("Width = #{f.columns}")
|
2815
|
+
txt.puts("Height = #{f.rows}")
|
2816
|
+
txt.print('Pixels = [')
|
2817
|
+
pixels = pixels.join(',')
|
2818
|
+
pixels.gsub!(/(\d+,){1,25}/) { "#{$&}\n" }
|
2819
|
+
txt.print(pixels)
|
2820
|
+
txt.puts(']')
|
2864
2821
|
}
|
2865
2822
|
exit
|
2866
2823
|
</pre>
|
@@ -2954,8 +2911,7 @@ exit
|
|
2954
2911
|
|
2955
2912
|
<h4>Returns</h4>the last value returned by the block
|
2956
2913
|
|
2957
|
-
<h4>Magick API</h4>GetNextImageProfile
|
2958
|
-
ImageMagick 6.0.0)
|
2914
|
+
<h4>Magick API</h4><p>GetNextImageProfile</p>
|
2959
2915
|
</div>
|
2960
2916
|
|
2961
2917
|
<div class="sig">
|
@@ -3011,7 +2967,7 @@ exit
|
|
3011
2967
|
<dt>sigma</dt>
|
3012
2968
|
|
3013
2969
|
<dd>The sigma (standard deviation) of the Gaussian operator.
|
3014
|
-
This value
|
2970
|
+
This value cannot be 0.0.</dd>
|
3015
2971
|
</dl>
|
3016
2972
|
|
3017
2973
|
<h4>Returns</h4>
|