-
Notifications
You must be signed in to change notification settings - Fork 2
/
image1.html
4545 lines (3113 loc) · 135 KB
/
image1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org" />
<title>RMagick 6.0.1: class Image (class methods and instance methods a-d)</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta name="GENERATOR" content="Quanta Plus" />
<meta name="Copyright" content="Copyright (C) 2006 by Timothy P. Hunter" />
<link rel="stylesheet" type="text/css" href="css/doc.css" />
<script type="text/javascript" src="scripts/doc.js"></script>
<script type="text/javascript">
//<![CDATA[
<!-- Pre-load this image so that the browser knows how big it is. -->
flower_hat = new Image();
flower_hat.src = "ex/images/Flower_Hat.jpg";
function show_noise(type) {
if (type == null) {
document.getElementById("add_noise_example").src = "ex/images/Flower_Hat.jpg";
} else {
document.getElementById("add_noise_example").src = "ex/add_noise_" + type + ".jpg";
}
}
//]]>
</script>
<style type="text/css">
/*<![CDATA[*/
.noise_example_wrapper img {
float: left;
}
.noise_example_wrapper p,
.noise_example_wrapper ul {
margin-left: 4px;
float: left;
}
/*]]>*/
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>
hljs.configure({ cssSelector: "pre" });
hljs.highlightAll();
</script>
</head>
<body>
<h6 id="header">RMagick 6.0.1 User's Guide and Reference</h6>
<div class="nav">« <a href="imageattrs.html">Prev</a> | <a href="index.html">Contents</a> | <a href="image2.html">Next</a> »</div>
<h1>
class Image <span class="superclass">< Object</span> (class methods and instance methods a-d)<br />
<span class="mixin">mixes in Comparable</span>
</h1>
<div id="toc">
<h2>Table of Contents</h2>
<h3>class methods</h3>
<div>
<div class="toccol">
<ul>
<li><a href="#capture">capture</a></li>
<li><a href="#combine">combine</a></li>
<li><a href="#constitute">constitute</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#from_blob">from_blob</a></li>
<li><a href="#new">new</a></li>
<li><a href="#ping">ping</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#read">read</a></li>
<li><a href="#read_inline">read_inline</a></li>
</ul>
</div>
</div>
<h3>instance methods</h3>
<div>
<div class="toccol">
<ul>
<li><a href="#aref">[ ]</a></li>
<li><a href="#aset">[ ]=</a></li>
<li><a href="#spaceship"><=></a></li>
<li><a href="#adaptive_blur">adaptive_blur</a></li>
<li><a href="#adaptive_blur_channel">adaptive_blur_channel</a></li>
<li><a href="#adaptive_resize">adaptive_resize</a></li>
<li><a href="#adaptive_sharpen">adaptive_sharpen</a></li>
<li>
<a href="#adaptive_sharpen_channel">adaptive_sharpen_channel</a>
</li>
<li><a href="#adaptive_threshold">adaptive_threshold</a></li>
<li><a href="#add_compose_mask">add_compose_mask</a></li>
<li><a href="#add_noise">add_noise</a></li>
<li><a href="#add_noise_channel">add_noise_channel</a></li>
<li><a href="#add_profile">add_profile</a></li>
<li><a href="#affine_transform">affine_transform</a></li>
<li><a href="#alpha">alpha</a></li>
<li><a href="#alpha_q">alpha?</a></li>
<li><a href="#annotate">annotate</a></li>
<li><a href="#auto_gamma_channel">auto_gamma_channel</a></li>
<li><a href="#auto_level_channel">auto_level_channel</a></li>
<li><a href="#auto_orient">auto_orient</a></li>
<li><a href="#auto_orient_bang">auto_orient!</a></li>
<li><a href="#bilevel_channel">bilevel_channel</a></li>
<li><a href="#black_threshold">black_threshold</a></li>
<li><a href="#blend">blend</a></li>
<li><a href="#blue_shift">blue_shift</a></li>
<li><a href="#blur_channel">blur_channel</a></li>
<li><a href="#blur_image">blur_image</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#border">border</a></li>
<li><a href="#border_bang">border!</a></li>
<li><a href="#bounding_box">bounding_box</a></li>
<li><a href="#change_geometry">change_geometry</a></li>
<li><a href="#changed_q">changed?</a></li>
<li><a href="#channel">channel</a></li>
<li><a href="#channel_depth">channel_depth</a></li>
<li><a href="#channel_extrema">channel_extrema</a></li>
<li><a href="#channel_mean">channel_mean</a></li>
<li><a href="#charcoal">charcoal</a></li>
<li><a href="#check_destroyed">check_destroyed</a></li>
<li><a href="#chop">chop</a></li>
<li><a href="#clone">clone</a></li>
<li><a href="#clut_channel">clut_channel</a></li>
<li><a href="#color_fill_to_border">color_fill_to_border</a></li>
<li><a href="#color_floodfill">color_floodfill</a></li>
<li><a href="#color_histogram">color_histogram</a></li>
<li><a href="#colorize">colorize</a></li>
<li><a href="#colormap">colormap</a></li>
<li><a href="#color_point">color_point</a></li>
<li><a href="#color_reset_bang">color_reset!</a></li>
<li><a href="#compare_channel">compare_channel</a></li>
<li><a href="#composite">composite</a></li>
<li><a href="#composite_bang">composite!</a></li>
<li><a href="#composite_affine">composite_affine</a></li>
<li><a href="#composite_mathematics">composite_mathematics</a></li>
<li><a href="#composite_tiled">composite_tiled</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#composite_tiled_bang">composite_tiled!</a></li>
<li><a href="#compress_colormap_bang">compress_colormap!</a></li>
<li><a href="#contrast">contrast</a></li>
<li>
<a href="#contrast_stretch_channel">contrast_stretch_channel</a>
</li>
<li><a href="#convolve">convolve</a></li>
<li><a href="#convolve_channel">convolve_channel</a></li>
<li><a href="#copy">copy</a></li>
<li><a href="#crop">crop</a></li>
<li><a href="#crop_bang">crop!</a></li>
<li><a href="#crop_resized">crop_resized</a></li>
<li><a href="#cycle_colormap">cycle_colormap</a></li>
<li><a href="#decipher">decipher</a></li>
<li><a href="#delete_compose_mask">delete_compose_mask</a></li>
<li><a href="#delete_profile">delete_profile</a></li>
<li><a href="#deskew">deskew</a></li>
<li><a href="#despeckle">despeckle</a></li>
<li><a href="#destroy_bang">destroy!</a></li>
<li><a href="#destroyed_q">destroyed?</a></li>
<li><a href="#difference">difference</a></li>
<li><a href="#dispatch">dispatch</a></li>
<li><a href="#displace">displace</a></li>
<li><a href="#display">display</a></li>
<li><a href="#dissolve">dissolve</a></li>
<li><a href="#distort">distort</a></li>
<li><a href="#distortion_channel">distortion_channel</a></li>
<li><a href="#dup">dup</a></li>
</ul>
</div>
</div>
</div>
<h2 class="methods">class methods</h2>
<div class="sig">
<h3 id="capture">capture</h3>
<p>
Image.capture(<span class="arg">silent=</span><code>false</code>, <span class="arg">frame=</span><code>false</code>, <span class="arg">descend=</span
><code>false</code>, <span class="arg">screen=</span><code>false</code>, <span class="arg">borders=</span><code>false</code>) [
<span class="arg">{ optional arguments }</span> ] ->
<em>image</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Reads an image from an X window. Unless you identify a window to capture via the <em>optional arguments</em> block, when <code>capture</code> is invoked
the cursor will turn into a cross. Click the cursor on the window to be captured.
</p>
<p>
Within the optional arguments block, specify
<code>options.filename = "root"</code> to capture the entire desktop. To programatically specify the window to be captured, use
<code>options.filename = window_id</code>, where window_id is the id displayed by xwininfo(1).
</p>
<h4>Arguments</h4>
<dl>
<dt>silent</dt>
<dd>
If <code>true</code>, suppress the beeps that signal the start and finish of the capture process. The bell rings once to signal the start of the
capture and twice to signal the finish.
</dd>
<dt>frame</dt>
<dd>If <code>true</code>, include the window frame.</dd>
<dt>descend</dt>
<dd>
If <code>true</code>,
<span class="imquote">obtain image by descending window hierarchy.</span>
</dd>
<dt>screen</dt>
<dd>
If <code>true</code>, specifies that
<span class="imquote"
>the GetImage request used to obtain the image should be done on the root window, rather than directly on the specified window. In this way, you can
obtain pieces of other windows that overlap the specified window, and more importantly, you can capture menus or other popups that are independent
windows but appear over the specified window.</span
>
</dd>
<dt>borders</dt>
<dd>If <code>true</code>, include the border in the image.</dd>
<dt>optional arguments</dt>
<dd>
You can specify any of these Image::Info attributes in the
<em>optional arguments</em> block: <a href="info.html#colorspace">colorspace</a>, <a href="info.html#depth">depth</a>,
<a href="info.html#dither">dither</a>, <a href="info.html#interlace">interlace</a>, and <a href="info.html#image_type">image_type</a>.
</dd>
</dl>
<h4>Returns</h4>
<p>A new image.</p>
<h4>Example</h4>
<pre class="language-ruby">
img = Magick::Image.capture { |options|
options.filename = "root"
}
</pre
>
</div>
<div class="sig">
<h3 id="combine">combine</h3>
<p>
Image.combine(<span class="arg">red_ch</span>=nil, <span class="arg">green_ch</span>=nil, <span class="arg">blue_ch</span>=nil<span class="arg"
>, opacity_ch</span
>=nil) -><em>image</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Combines the grayscale value of the pixels in each image to form a new image.</p>
<h4>Arguments</h4>
<p>
The red channel of the image specified in the first argument is used as the red channel in the new image. The green channel of the image specified in
the second argument is used as the green channel in the new image. The blue channel of the image specified in the third argument is used as the blue
channel in the new image. The opacity channel of the image specified in the fourth argument is used as the opacity channel in the new image.
</p>
<p>Any of the arguments may be nil. Trailing nil arguments may be omitted. You must specify at least one image argument.</p>
<h4>Returns</h4>
<p>A new image</p>
<h4>See also</h4>
<p>
The same results can be obtained using the
<a href="#composite">composite</a> method and the CopyRed/Green/Blue/OpacityCompositeOp
<a href="constants.html#CompositeOperator">CompositeOperator</a> enum values.
</p>
<h4>Magick API</h4>
<p>CombineImages</p>
</div>
<div class="sig">
<h3 id="constitute">constitute</h3>
<p>
Image.constitute(<span class="arg">width</span>, <span class="arg">height</span>, <span class="arg">map</span>, <span class="arg">pixels</span>) ->
<em>image</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Creates an image from an array of pixels. This method is the reverse of
<a href="#dispatch"><code>dispatch</code></a
>.
</p>
<h4>Arguments</h4>
<dl>
<dt>width</dt>
<dd>The number of columns in the image</dd>
<dt>height</dt>
<dd>The number of rows in the image</dd>
<dt>map</dt>
<dd>
A string describing
<span class="imquote"
>the expected ordering of the pixel array. It can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M =
magenta, K = black, or I = intensity (for grayscale).</span
>
</dd>
<dt>pixels</dt>
<dd>
The pixel data. The pixel data in the array must be stored in scanline order, left-to-right and top-to-bottom. The elements in the array must be
either all <code>Integers</code> or all <code>Floats</code>. If the elements are <code>Integers</code>, the <code>Integers</code>
must be in the range [0..QuantumRange]. If the elements are
<code>Floats</code>, they must be in the range [0..1].
</dd>
</dl>
<h4>Returns</h4>
<p>An image constructed from the pixel data.</p>
<h4>Example</h4>
<pre class="language-ruby">image = Magick::Image.constitute(width, height, "RGB", pixels)</pre>
<h4>See also</h4>
<p><a href="image2.html#import_pixels">import_pixels</a>, <a href="image3.html#store_pixels">store_pixels</a></p>
<h4>Magick API</h4>
<p>ConstituteImage</p>
</div>
<div class="sig">
<h3 id="from_blob">from_blob</h3>
<p>Image.from_blob(<span class="arg">string</span>) [ <span class="arg">{ optional arguments }</span> ] -> <em>array</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Creates an array of images from a BLOB, that is, a <em>B</em>inary <em>L</em>arge <em>OB</em>ject. In RMagick, a BLOB is a string.</p>
<h4>Arguments</h4>
<p>
A blob can be a string containing an image file such as a JPEG or GIF. The string can contain a multi-image file such as an animated GIF or a Photoshop
image with multiple layers. A blob can also be one of the strings produced by <a href="image3.html#to_blob">to_blob</a>. Control the format of the
created image(s) by setting additional <a href="info.html">Image::Info</a> attributes in the optional block argument.
</p>
<h4>Returns</h4>
<p>An array of one or more images constructed from the BLOB.</p>
<h4>Example</h4>
<p>See <a href="image3.html#to_blob">to_blob</a>.</p>
<h4>Magick API</h4>
<p>BlobToImage</p>
</div>
<div class="sig">
<h3 id="new">new</h3>
<p>
Image.new(<span class="arg">columns</span>, <span class="arg">rows</span> [, <span class="arg">fill</span>]) [
<span class="arg">{ optional arguments }</span> ] -> <em>image</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
Creates a new instance with the specified number of columns and rows. You can specify other arguments by setting
<a href="info.html">Image::Info</a> attributes in the optional block. If the optional <span class="arg">fill</span>
argument is not specified, the image is set to the background color.
<h4>Arguments</h4>
<dl>
<dt>columns</dt>
<dd>The number of columns</dd>
<dt>rows</dt>
<dd>The number of rows</dd>
<dt>fill</dt>
<dd>A <a href="struct.html#fill">Fill</a> object</dd>
</dl>
<h4>Returns</h4>
<p>A new image.</p>
<h4>Example</h4>
<pre class="language-ruby">
img = Magick::Image.new(256, 64) { |options|
options.background_color = 'red'
}
</pre
>
<h4>See also</h4>
<p>
<a href="ilist.html#new_image">ImageList.new_image</a>
</p>
<h4>Magick API</h4>
<p>AllocateImage</p>
</div>
<div class="sig">
<h3 id="ping">ping</h3>
<p>
Image.ping(<span class="arg">filename</span>) [ <span class="arg">{ optional arguments }</span> ] -> <em>array</em><br />
Image.ping(<span class="arg">file</span>) [ <span class="arg">{ optional arguments }</span> ] -> <em>array</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Creates one or more images from the image file, omitting the pixel data. Only the attributes are stored in the images. This method is faster than
<a href="#read">read</a> and uses less memory.
</p>
<h4>Arguments</h4>
<p>
An image file name or open file object. You can specify other arguments by setting <a href="info.html">Image::Info</a> attributes in the optional block.
</p>
<h4>Returns</h4>
<p>An array containing 0 or more images.</p>
<h4>Example</h4>
<pre class="language-ruby">
cheetah = Magick::Image.ping("Cheetah.jpg") #=> [Cheetah.jpg JPEG 1024x768 DirectClass 8-bit 101684b]
p cheetah[0].rows #=> 768
p cheetah[0].columns #=> 1024
</pre
>
<h4>See also</h4>
<p>
<a href="#read">read</a>
</p>
<h4>Magick API</h4>
<p>PingImage</p>
</div>
<div class="sig">
<h3 id="read">read</h3>
<p>
Image.read(<span class="arg">filename</span>) [ <span class="arg">{ optional arguments }</span> ] -> <em>array</em><br />
Image.read(<span class="arg">file</span>) [ <span class="arg">{ optional arguments }</span> ] -> <em>array</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Reads all the images from the specified file.</p>
<p>
<span style="font-style: italic">Note:</span> Because an image file can contain multiple images or multiple image layers, <code>read</code> always
returns an array containing 0 or more elements, one element for each image or image layer in the file.
</p>
<h4>Arguments</h4>
<p>
An image file name or open file object. You can specify other arguments by setting <a href="info.html">Image::Info</a> attributes in the optional block.
</p>
<h4>Returns</h4>
<p>
An array containing 0 or more Image objects. If the file is a multi-image file such as an animated GIF or a Photoshop PSD file with multiple layers, the
array contains an Image object for each image or layer in the file.
</p>
<h4>Example</h4>
<pre class="language-ruby">
animated = Magick::Image.read("animated.gif")
#=> [animated.gif GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b
# animated.gif[1] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b,
# animated.gif[2] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b]
</pre
>
<h4>See also</h4>
<p>
<a href="#ping">ping</a>
</p>
<h4>Note</h4>
<p>
The read method does not accept a StringIO object. If you want to create an image from a string buffer, use
<a href="image1.html#from_blob">from_blob</a>.
</p>
<h4>Magick API</h4>
<p>ReadImage</p>
</div>
<div class="sig">
<h3 id="read_inline">read_inline</h3>
<p>Image.read_inline(<span class="arg">content</span>) [ <span class="arg">{ optional arguments }</span> ] -> <em>array</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Converts a Base64-encoded image or multi-image sequence to an array of Image objects.</p>
<h4>Arguments</h4>
<p>
A Base64-encoded string. Generally no optional arguments are required. If the image format cannot be deduced from the image data, you can use the
<a href="info.html#format">format</a> attribute. If you want to extract a subset of an image sequence, see <a href="imusage.html#frames">here</a>.
</p>
<h4>Returns</h4>
<p>
An array containing 0 or more Image objects. If the content is a multi-image sequence such as an animated GIF or a Photoshop PSD file with multiple
layers, the array contains an Image object for each image or layer in the file.
</p>
<h4>Example</h4>
<pre class="language-ruby">
content = "R0lGODlhnAEuAferAAAAAAcIBggJBgw..."
img = Magick::Image.read_inline(content)
</pre
>
<h4>See also</h4>
<p>
<a href="#read">read</a>
</p>
</div>
<h2 class="methods">instance methods</h2>
<div class="sig">
<h3 id="aref">[ ]</h3>
<p>
<span class="arg">img</span>[<span class="arg">key</span>] ->
<em>string</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Returns the value of the image property identified by
<span class="arg">key</span>. An image may have any number of properties. Each property is identified by a string (or symbol) key. The property value is
a string. ImageMagick predefines some properties, including <code>Label</code>, <code>Comment</code>, <code>Signature</code>, and in some cases
<code>EXIF</code>.
</p>
<h4>Arguments</h4>
The key may be a <code>String</code> or a <code>Symbol</code>.
<h4>Returns</h4>
<p>The value of the property.</p>
<h4>Example</h4>
<pre class="language-ruby">mom['Label'] = 'My Mother'</pre>
<h4>See also</h4>
<p><a href="#aset">[ ]=</a>, <a href="image3.html#properties">properties</a></p>
<h4>Magick API</h4>
<p>GetImageAttribute</p>
<h4>Note</h4>
<p>
ImageMagick calls properties "attributes." I use the word "properties" to reduce the confusion with image object attributes such as
<code>rows</code> and <code>columns</code>.
</p>
</div>
<div class="sig">
<h3 id="aset">[ ]=</h3>
<p><span class="arg">img</span>[<span class="arg">key</span>] = <span class="arg">string</span> -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Sets the value of an image property. An image may have any number of properties.</p>
<h4>Arguments</h4>
The <span class="arg">key</span> may be a string or a symbol. The value can be any string.
<h4>Returns</h4>
<code>self</code>
<h4>Example</h4>
See <a href="javascript:popup('demo.rb.html')">demo.rb</a> for an example of the use of the Label property.
<h4>See also</h4>
<p><a href="#aref">[ ]</a>, <a href="image3.html#properties">properties</a></p>
<h4>Magick API</h4>
<p>SetImageAttribute</p>
</div>
<div class="sig">
<h3 id="spaceship"><=></h3>
<p><span class="arg">img</span> <=> <span class="arg">other_image</span> -> -1, 0, 1</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Compares two images and returns -1, 0, or 1 if
<span class="arg">img</span> is less than, equal to, or greater than <span class="arg">other_image</span> as determined by comparing the signatures of
the images. If one of the arguments is not an image, this method raises a TypeError exception (in Ruby 1.6) or returns <code>nil</code> (in Ruby 1.8)
</p>
<p>
In addition to <=>, <code>Image</code> mixes in the <code>Comparable</code> module, which defines the <, <=, == >=, >, and
<code>between?</code> methods.
</p>
<p>
The <code>difference</code> method compares images (for equality only) but also returns information about the amount two images differ, which may be
more useful.
</p>
<h4>Returns</h4>
<p>The value of <span class="arg">img</span>.<code>signature</code> <=> <span class="arg">other_image</span>.<code>signature</code>.</p>
<h4>See also</h4>
<p>
<a href="image3.html#signature">signature</a>, <a href="#difference">difference</a>,
<a href="#compare_channel">compare_channel</a>
</p>
<h4>Magick API</h4>
<p>SignatureImage</p>
</div>
<div class="sig">
<h3 id="adaptive_blur">adaptive_blur</h3>
<p><span class="arg">img</span>.adaptive_blur(<span class="arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0) -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
<span class="imquote">Adaptively blurs the image by blurring more intensely near image edges and less intensely far from edges.</span>
The adaptive_blur method blurs
<span class="imquote">the image with a Gaussian operator of the given</span>
<span class="arg">radius</span>
<span class="imquote">and standard deviation</span> (<span class="arg">sigma</span>). <span class="imquote">For reasonable results,</span>
<span class="arg">radius</span>
<span class="imquote">should be larger than</span>
<span class="arg">sigma</span>. <span class="imquote">Use a</span>
<span class="arg">radius</span>
<span class="imquote">of 0 and adaptive_blur selects a suitable</span>
<span class="arg">radius</span> <span class="imquote">for you.</span>
</p>
<h4>Arguments</h4>
<dl>
<dt>radius</dt>
<dd>
<span class="imquote">The radius of the Gaussian in pixels, not counting the center pixel.</span>
The default is 0.0.
</dd>
<dt>sigma</dt>
<dd>
<span class="imquote">The standard deviation of the Laplacian, in pixels.</span>
The default is 1.0.
</dd>
</dl>
<h4>Returns</h4>
<p>A new image</p>
<h4>See also</h4>
<p><a href="#adaptive_blur_channel">adaptive_blur_channel</a></p>
<h4>Magick API</h4>
<p>AdaptiveBlurImage</p>
</div>
<div class="sig">
<h3 id="adaptive_blur_channel">adaptive_blur_channel</h3>
<p>
<span class="arg">img</span>.adaptive_blur(<span class="arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0 [,<span class="arg">channel</span
>...]) -> <em>image</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>The same as <code>adaptive_blur</code> except only the specified channels are blurred.</p>
<h4>Arguments</h4>
<dl>
<dt>radius</dt>
<dd>
<span class="imquote">The radius of the Gaussian in pixels, not counting the center pixel.</span>
The default is 0.0.
</dd>
<dt>sigma</dt>
<dd>
<span class="imquote">The standard deviation of the Laplacian, in pixels.</span>
The default is 1.0.
</dd>
<dt>channel...</dt>
<dd>
0 or more
<a href="constants.html#ChannelType">ChannelType</a> arguments. If no channels are specified, blurs all the channels. Specifying no channel arguments
has the same effect as the <code>adaptive_blur</code> method, above.
</dd>
</dl>
<h4>Returns</h4>
<p>A new image</p>
<h4>See also</h4>
<p><a href="#adaptive_blur">adaptive_blur</a></p>
<h4>Magick API</h4>
<p>AdaptiveBlurImageChannel</p>
</div>
<div class="sig">
<h3 id="adaptive_resize">adaptive_resize</h3>
<p>
<span class="arg">img</span>.adaptive_resize(<span class="arg">new_width</span>, <span class="arg">new_height</span>) -> <em>image</em><br />
<span class="arg">img</span>.adaptive_resize(<span class="arg">scale_factor</span>) -> <span class="arg">image</span>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Resizes the image with data dependent triangulation.</p>
<h4>Arguments</h4>
<p>
You can specify the new size in two ways. Either specify the new width and height explicitly, or specify a <em>scale factor</em>, a number that
represents the percentage change.
</p>
<p>
Use the <a href="#change_geometry">change_geometry</a> method to compute new dimensions for an image with constraints such as "maintain the current
proportions."
</p>
<dl>
<dt>new_width, new_height</dt>
<dd>The desired width and height.</dd>
<dt>scale_factor</dt>
<dd>
You can use this argument instead of specifying the desired width and height. The percentage size change. For example, 1.25 makes the new image 125%
of the size of the receiver. The scale factor 0.5 makes the new image 50% of the size of the receiver.
</dd>
</dl>
<h4>Returns</h4>
<p>A new image</p>
<h4>See also</h4>
<p><a href="image3.html#resize">resize</a></p>
<h4>Magick API</h4>
<p>AdaptiveResizeImage</p>
</div>
<div class="sig">
<h3 id="adaptive_sharpen">adaptive_sharpen</h3>
<p><span class="arg">img</span>.adaptive_sharpen(<span class="arg">radius</span>=0.0, <span class="arg">sigma</span>=1.0) -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
<span class="imquote">Adaptively sharpens the image by sharpening more intensely near image edges and less intensely far from edges.</span>
The adaptive_sharpen method sharpens
<span class="imquote">the image with a Gaussian operator of the given</span>
<span class="arg">radius</span>
<span class="imquote">and standard deviation</span> (<span class="arg">sigma</span>). <span class="imquote">For reasonable results,</span>
<span class="arg">radius</span>
<span class="imquote">should be larger than</span>
<span class="arg">sigma</span>. <span class="imquote">Use a</span>
<span class="arg">radius</span>
<span class="imquote">of 0 and adaptive_sharpen selects a suitable</span>
<span class="arg">radius</span> <span class="imquote">for you.</span>
</p>