-
Notifications
You must be signed in to change notification settings - Fork 2
/
image2.html
3606 lines (2463 loc) · 97.8 KB
/
image2.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 (instance methods e-o)</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" src="scripts/stripeTables.js"></script>
<script type="text/javascript">
//<![CDATA[
addLoadEvent(stripeTables);
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
<!-- Pre-load this image so that the browser knows how big it is. -->
<!-- Begin
flower_hat = new Image();
flower_hat.src = "ex/images/Flower_Hat.jpg";
// End -->
//]]>
</script>
<style type="text/css">
/*<![CDATA[*/
#iptc {
border: thin solid black;
}
#iptc th {
background-color: #c0c0c0;
}
td.ds {
text-align: right;
}
/*]]>*/
</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="image1.html">Prev</a> | <a href="index.html">Contents</a> | <a href="image3.html">Next</a> »</div>
<h1>
class Image <span class="superclass">< Object</span> (instance methods e-o)<br />
<span class="mixin">mixes in Comparable</span>
</h1>
<div id="toc">
<h2>Table of Contents</h2>
<h3>instance methods</h3>
<div>
<div class="toccol">
<ul>
<li><a href="#each_iptc_dataset">each_iptc_dataset</a></li>
<li><a href="#each_pixel">each_pixel</a></li>
<li><a href="#each_profile">each_profile</a></li>
<li><a href="#edge">edge</a></li>
<li><a href="#emboss">emboss</a></li>
<li><a href="#encipher">encipher</a></li>
<li><a href="#enhance">enhance</a></li>
<li><a href="#equalize">equalize</a></li>
<li><a href="#equalize_channel">equalize_channel</a></li>
<li><a href="#erase_bang">erase!</a></li>
<li><a href="#excerpt">excerpt</a></li>
<li><a href="#excerpt_bang">excerpt!</a></li>
<li><a href="#export_pixels">export_pixels</a></li>
<li><a href="#export_pixels_to_str">export_pixels_to_str</a></li>
<li><a href="#extent">extent</a></li>
<li><a href="#find_similar_region">find_similar_region</a></li>
<li><a href="#flip">flip</a></li>
<li><a href="#flip_bang">flip!</a></li>
<li><a href="#flop">flop</a></li>
<li><a href="#flop_bang">flop!</a></li>
<li><a href="#frame">frame</a></li>
<li><a href="#freeze">freeze</a></li>
<li><a href="#function_channel">function_channel</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#gamma_channel">gamma_channel</a></li>
<li><a href="#gamma_correct">gamma_correct</a></li>
<li><a href="#gaussian_blur">gaussian_blur</a></li>
<li><a href="#gaussian_blur_channel">gaussian_blur_channel</a></li>
<li><a href="#get_exif_by_entry">get_exif_by_entry</a></li>
<li><a href="#get_exif_by_number">get_exif_by_number</a></li>
<li><a href="#get_iptc_dataset">get_iptc_dataset</a></li>
<li><a href="#get_pixels">get_pixels</a></li>
<li><a href="#gray_q">gray?</a></li>
<li><a href="#grey_q">grey?</a></li>
<li><a href="#histogram_q">histogram?</a></li>
<li><a href="#implode">implode</a></li>
<li><a href="#import_pixels">import_pixels</a></li>
<li><a href="#inspect">inspect</a></li>
<li><a href="#level">level</a></li>
<li><a href="#level_channel">level_channel</a></li>
<li><a href="#level_colors">level_colors</a></li>
<li><a href="#levelize_channel">levelize_channel</a></li>
<li><a href="#linear_stretch">linear_stretch</a></li>
<li><a href="#liquid_rescale">liquid_rescale</a></li>
<li><a href="#magnify">magnify</a></li>
<li><a href="#magnify_bang">magnify!</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#mask">mask</a></li>
<li><a href="#matte_fill_to_border">matte_fill_to_border</a></li>
<li><a href="#matte_floodfill">matte_floodfill</a></li>
<li><a href="#matte_point">matte_point</a></li>
<li><a href="#matte_replace">matte_replace</a></li>
<li><a href="#matte_reset_bang">matte_reset!</a></li>
<li><a href="#median_filter">median_filter</a></li>
<li><a href="#minify">minify</a></li>
<li><a href="#minify_bang">minify!</a></li>
<li><a href="#modulate">modulate</a></li>
<li><a href="#monochrome_q">monochrome?</a></li>
<li><a href="#motion_blur">motion_blur</a></li>
<li><a href="#negate">negate</a></li>
<li><a href="#negate_channel">negate_channel</a></li>
<li><a href="#normalize">normalize</a></li>
<li><a href="#normalize_channel">normalize_channel</a></li>
<li><a href="#oil_paint">oil_paint</a></li>
<li><a href="#opaque">opaque</a></li>
<li><a href="#opaque_channel">opaque_channel</a></li>
<li><a href="#opaque_q">opaque?</a></li>
<li><a href="#ordered_dither">ordered_dither</a></li>
</ul>
</div>
</div>
</div>
<h2 class="methods">instance methods</h2>
<div class="sig">
<h3 id="each_iptc_dataset">each_iptc_dataset</h3>
<p>
<span class="arg">img</span>.each_iptc_dataset { |<span class="arg">dataset</span>, <span class="arg">data_field</span>| <span class="arg">block</span>}
-> <code>nil</code>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Iterates over the IPTC DataSet constants in Magick::IPTC. If the image's IPTC profile has the DataSet and the data field has non-0 length, yields to the
block. The IPTC DataSet constants are listed
<a href="image2.html#get_iptc_dataset">here</a>.
</p>
<h4>Arguments</h4>
<p>The block arguments are:</p>
<dl>
<dt>dataset</dt>
<dd>The DataSet name</dd>
<dt>data_field</dt>
<dd>The data field</dd>
</dl>
<h4>See also</h4>
<p><a href="image2.html#get_iptc_dataset">get_iptc_dataset</a></p>
</div>
<div class="sig">
<h3 id="each_pixel">each_pixel</h3>
<p>
<span class="arg">img</span>.each_pixel {|<span class="arg">pixel</span>, <span class="arg">c</span>, <span class="arg">r</span>|
<span class="arg">block</span> } -> <em>self</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Calls <span class="arg">block</span> with 3 arguments, a <span class="arg">pixel</span> from <span class="arg">img</span>, its column number
<span class="arg">c</span>, and its row number <span class="arg">r</span>, for all the pixels in the image. The pixels are enumerated from top-to-bottom
and left-to-right.
</p>
<h4>Returns</h4>
<p>self</p>
<h4>See also</h4>
<p><a href="image2.html#get_pixels">get_pixels</a></p>
</div>
<div class="sig">
<h3 id="each_profile">each_profile</h3>
<p>
<span class="arg">img</span>.each_profile {|<span class="arg">name</span>, <span class="arg">value</span>| <span class="arg">block</span>} ->
<em>???</em> (see Returns)
</p>
</div>
<div class="desc">
<h4>Description</h4>
Calls <span class="arg">block</span> once for each profile in the image, passing the profile name and value as parameters.
<h4>Returns</h4>
<p>the last value returned by the block</p>
<h4>See also</h4>
<p>
The <a href="imageattrs.html#color_profile">color_profile</a> and <a href="imageattrs.html#iptc_profile">iptc_profile</a> attributes return the ICC and
IPTC profiles, respectively.
</p>
<h4>Magick API</h4>
<p>GetNextImageProfile</p>
</div>
<div class="sig">
<h3 id="edge">edge</h3>
<p><span class="arg">img</span>.edge(<span class="arg">radius</span>=0.0) -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
Finds edges in the image.
<h4>Arguments</h4>
The radius of the convolution filter. If the radius is 0,
<code>edge</code> selects a suitable default.
<h4>Returns</h4>
<p>A new image</p>
<h4>Example</h4>
<p class="rollover">
<a href="javascript:popup('edge.rb.html')"
><img
onmouseover="this.src='ex/images/Flower_Hat.jpg'"
onmouseout="this.src='ex/edge.jpg'"
src="ex/edge.jpg"
alt="edge example"
title="Click the image to see the example script"
/></a>
<img src="ex/images/spin.gif" alt="" class="spin" title="Mouse over the example to see the original image" />
</p>
<h4>Magick API</h4>
<p>EdgeImage</p>
</div>
<div class="sig">
<h3 id="emboss">emboss</h3>
<p><span class="arg">img</span>.emboss(<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>
Adds a 3-dimensional effect.
<h4>Arguments</h4>
<dl>
<dt>radius</dt>
<dd>The radius of the Gaussian operator.</dd>
<dt>sigma</dt>
<dd>The sigma (standard deviation) of the Gaussian operator. This value cannot be 0.0.</dd>
</dl>
<h4>Returns</h4>
<p>A new image</p>
<h4>Example</h4>
<p class="rollover">
<a href="javascript:popup('emboss.rb.html')"
><img
onmouseover="this.src='ex/images/Flower_Hat.jpg'"
onmouseout="this.src='ex/emboss.jpg'"
src="ex/emboss.jpg"
alt="emboss example"
title="Click the image to see the example script" /></a
><img src="ex/images/spin.gif" alt="" class="spin" title="Mouse over the example to see the original image" />
</p>
<h4>Magick API</h4>
<p>EmbossImage</p>
</div>
<div class="sig">
<h3 id="encipher">encipher</h3>
<p><span class="arg">img</span>.encipher(<span class="arg">passphrase</span>) -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Encipher an image.</p>
<h4>Arguments</h4>
<p>The passphrase.</p>
<h4>Returns</h4>
<p>A new image</p>
<h4>Example</h4>
<pre class="language-ruby">enciphered_img = img.encipher("magic word")</pre>
<h4>Magick API</h4>
<p>EncipherImage</p>
<h4>See also</h4>
<p><a href="image1.html#decipher">decipher</a></p>
</div>
<div class="sig">
<h3 id="enhance">enhance</h3>
<p><span class="arg">img</span>.enhance -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p class="imquote">Applies a digital filter that improves the quality of a noisy image.</p>
<h4>Returns</h4>
<p>A new image</p>
<h4>Example</h4>
<p>
The left-hand side has had noise added by
<code><a href="image1.html#add_noise">add_noise</a></code
>. The right-hand side is the result after using <code>enhance</code>.
</p>
<p>
<a href="javascript:popup('enhance.rb.html')"><img src="ex/enhance.jpg" alt="enhance example" title="Click to see the example script" /></a>
</p>
<h4>See also</h4>
<p>
<a href="image2.html#median_filter">median_filter</a>, <a href="image3.html#reduce_noise">reduce_noise</a>,
<a href="image3.html#unsharp_mask">unsharp_mask</a>
</p>
<h4>Magick API</h4>
<p>EnhanceImage</p>
</div>
<div class="sig">
<h3 id="equalize">equalize</h3>
<p><span class="arg">img</span>.equalize -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p class="imquote">Applies a histogram equalization to the image.</p>
<h4>Returns</h4>
<p>A new image</p>
<h4>Example</h4>
<p class="rollover">
<a href="javascript:popup('equalize.rb.html')"
><img
onmouseover="this.src='ex/images/Flower_Hat.jpg'"
onmouseout="this.src='ex/equalize.jpg'"
src="ex/equalize.jpg"
alt="equalize example"
title="Click to see the example script"
/></a>
<img src="ex/images/spin.gif" alt="" class="spin" title="Mouse over the example to see the original image" />
</p>
<h4>Magick API</h4>
<p>EqualizeImage</p>
<h4>See also</h4>
<p><a href="#equalize_channel">equalize_channel</a></p>
</div>
<div class="sig">
<h3 id="equalize_channel">equalize_chanel</h3>
<p><span class="arg">img</span>.equalize_channel(<span class="arg">[channel...]</span>) -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
<span class="imquote">Applies a histogram equalization to the image.</span>
Only the specified channels are equalized.
</p>
<h4>Arguments</h4>
<dl>
<dt>channel...</dt>
<dd>
0 or more
<a href="constants.html#ChannelType">ChannelType</a> arguments. If no channels are specified, all the channels are normalized. Specifying no channel
arguments has the same effect as the equalize method, above.
</dd>
</dl>
<h4>Returns</h4>
<p>A new image</p>
<h4>Magick API</h4>
<p>EqualizeImageChannel</p>
<h4>See also</h4>
<p><a href="#equalize">equalize</a></p>
</div>
<div class="sig">
<h3 id="erase_bang">erase!</h3>
<p><span class="arg">img</span>.erase! -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Sets the entire image to the
<a href="imageattrs.html#background_color">background_color</a>.
</p>
<h4>Returns</h4>
self
<h4>See also</h4>
<p><a href="image1.html#color_reset_bang">color_reset!</a></p>
<h4>Magick API</h4>
<p>SetImage</p>
</div>
<div class="sig">
<h3 id="excerpt">excerpt</h3>
<p>
<span class="arg">img</span>.excerpt(<span class="arg">x</span>, <span class="arg">y</span>, <span class="arg">width</span>,
<span class="arg">height</span>) -> image
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
This method is very similar to <a href="image1.html#crop">crop</a>. It extracts the rectangle specified by its arguments from the image and returns it
as a new image. However, excerpt
<span class="imquote">does not respect the virtual page offset and does not update the page offset and is more efficient than cropping.</span>
</p>
<p>It is the caller's responsibility to ensure that the rectangle lies entirely within the original image.</p>
<h4>Arguments</h4>
<dl>
<dt>x, y</dt>
<dd>The position of the upper-left corner of the excerpted rectangle.</dd>
<dt>width, height</dt>
<dd>
The width and height of the excerpted rectangle. The resulting image will always be <span class="arg">width</span>x<span class="arg">height</span>
in size.
</dd>
</dl>
<h4>Returns</h4>
<p>A new image</p>
<h4>See Also</h4>
<p>
<a href="image1.html#crop">crop</a>,
<a href="#excerpt_bang">excerpt!</a>
</p>
<h4>Magick API</h4>
<p>ExcerptImage</p>
</div>
<div class="sig">
<h3 id="excerpt_bang">excerpt!</h3>
<p>
<span class="arg">img</span>.excerpt!(<span class="arg">x</span>, <span class="arg">y</span>, <span class="arg">width</span>,
<span class="arg">height</span>) -> <span class="arg">img</span>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>In-place form of <a href="#excerpt">excerpt</a>.</p>
</div>
<div class="sig">
<h3 id="export_pixels">export_pixels</h3>
<p>
<span class="arg">img</span>.export_pixels(<span class="arg">x</span>=0, <span class="arg">y</span>=0, <span class="arg">columns</span>=<span
class="arg"
>img</span
>.columns, <span class="arg">rows</span>=<span class="arg">img</span>.rows, <span class="arg">map</span>="RGB") -> <em>array</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Extracts the pixel data from the specified rectangle and returns it as an array of <code>Integer</code> values.</p>
<p>The array returned by <code>export_pixels</code> is suitable for use as an argument to <code>import_pixels</code>.</p>
<h4>Arguments</h4>
<dl>
<dt>x, y</dt>
<dd>The offset of the rectangle from the upper-left corner of the image.</dd>
<dt>columns, rows</dt>
<dd>The width and height of the rectangle.</dd>
<dt>map</dt>
<dd>
A string that describes which pixel channel data is desired and the order in which it should be stored.
<span class="imquote"
>It can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for
grayscale), or P = pad.</span
>
</dd>
</dl>
<h4>Returns</h4>
An array
<h4>Example</h4>
<pre class="language-ruby">
# Export the r'th scanline from an image in red-green-blue order
scanline = img.export_pixels(0, r, img.columns, 1, "RGB");
</pre
>
<h4>See also</h4>
<p>
<a href="image1.html#dispatch">dispatch</a>, <a href="#export_pixels_to_str">export_pixels_to_str</a>, <a href="#import_pixels">import_pixels</a>,
<a href="#get_pixels">get_pixels</a>
</p>
<h4>Magick API</h4>
<p>ExportImagePixels</p>
<h4>Note</h4>
<p>This method replaces the <code>dispatch</code> method.</p>
</div>
<div class="sig">
<h3 id="export_pixels_to_str">export_pixels_to_str</h3>
<p>
<span class="arg">img</span>.export_pixels_to_str(<span class="arg">x</span>=0, <span class="arg">y</span>=0, <span class="arg">columns</span>=<span
class="arg"
>img</span
>.columns, <span class="arg">rows</span>=<span class="arg">img</span>.rows, <span class="arg">map</span>="RGB",
<span class="arg">type</span>=<code>CharPixel</code>) ->
<em>string</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Extracts the pixel data from the specified rectangle and returns it as a string. If you need to get the pixel data in a memory buffer (as input to
another application, for example), this method is much, much faster than <a href="#export_pixels">export_pixels</a> or
<a href="#get_pixels">get_pixels</a>.
</p>
<p>The string returned by <code>export_pixels_to_str</code> is suitable for use as an argument to <code>import_pixels</code>.</p>
<p><strong>Note:</strong> You can also use <a href="image3.html#to_blob">to_blob</a> to convert an image into a string.</p>
<h4>Arguments</h4>
<dl>
<dt>x, y</dt>
<dd>The offset of the rectangle from the upper-left corner of the image.</dd>
<dt>columns, rows</dt>
<dd>The width and height of the rectangle.</dd>
<dt>map</dt>
<dd>
A string that describes which pixel channel data is desired and the order in which it should be stored.
<span class="imquote"
>It can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for
grayscale), or P = pad.</span
>
</dd>
<dt>type</dt>
<dd>
A <a href="constants.html#StorageType">StorageType</a> value that specifies the C datatype to which the pixel data will be converted. The default is
<code>CharPixel</code>, which means that the pixel values will be stored as C <code>unsigned char</code>s.
</dd>
</dl>
<h4>Returns</h4>
<p>a string</p>
<h4>See also</h4>
<p>
<a href="image1.html#dispatch">dispatch</a>, <a href="#export_pixels">export_pixels</a>, <a href="#import_pixels">import_pixels</a>,
<a href="#get_pixels">get_pixels</a>
</p>
<h4>Magick API</h4>
<p>ExportImagePixels</p>
</div>
<div class="sig">
<h3 id="extent">extent</h3>
<p>
<span class="arg">img</span>.extent(<span class="arg">width</span>, <span class="arg">height</span>, <span class="arg">x</span>=0,
<span class="arg">y</span>=0) -> <em>image</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
If <span class="arg">width</span> or <span class="arg">height</span> is greater than the target image's width or height, extends the width and height of
the target image to the specified values. The new pixels are set to the background color. If <span class="arg">width</span> or
<span class="arg">height</span> is less than the target image's width or height, crops the target image.
</p>
<h4>Arguments</h4>
<dl>
<dt>width</dt>
<dd>The width of the new image</dd>
<dt>height</dt>
<dd>The height of the new image</dd>
<dt>x, y</dt>
<dd>The upper-left corner of the new image is positioned at -<span class="arg">x</span>, -<span class="arg">y</span>.</dd>
</dl>
<h4>Returns</h4>
<p>A new image</p>
<h4>Notes</h4>
<p>
The new image is composed over the background using the composite operator specified by target image's
<a href="imageattrs.html#compose">compose</a> attribute.
</p>
<h4>Magick API</h4>
<p>ExtentImage</p>
</div>
<div class="sig">
<h3 id="find_similar_region">find_similar_region</h3>
<p>
<span class="arg">img</span>.find_similar_region(<span class="arg">target</span>, <span class="arg">x</span>=0, <span class="arg">y</span>=0) ->
<em>[rx, ry]</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
This interesting method searches for a rectangle in the image that is
<em>similar</em> to the target. For the rectangle to be <em>similar</em> each pixel in the rectangle must match the corresponding pixel in the target
image within the range specified by the <code>fuzz</code> attributes of the image and the target image.
</p>
<h4>Arguments</h4>
<dl>
<dt>target</dt>
<dd>An image that forms the target of the search. This image can be any size.</dd>
<dt>x, y</dt>
<dd>
The starting <em>x-</em> and <em>y-</em>offsets for the search. If omitted both <span class="arg">x</span> and <span class="arg">y</span> default to
0.
</dd>
</dl>
<h4>Returns</h4>
<p>
If the search succeeds, the return value is an array with 2 elements. These elements are the <em>x-</em> and <em>y-</em>offsets of the matching
rectangle. If the search fails the return value is <code>nil</code>.
</p>
<h4>Magick API</h4>
<p>IsImageSimilar</p>
</div>
<div class="sig">
<h3 id="flip">flip</h3>
<p><span class="arg">img</span>.flip -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Create a vertical mirror image of the receiver.</p>
<h4>Returns</h4>
<p>A new image</p>
<h4>Example</h4>
<p class="rollover">
<a href="javascript:popup('flip.rb.html')"
><img
onmouseover="this.src='ex/images/Flower_Hat.jpg'"
onmouseout="this.src='ex/flip.jpg'"
src="ex/flip.jpg"
alt="flip example"
title="Click to see the example script"
/></a>
<img src="ex/images/spin.gif" alt="" class="spin" title="Mouse over the example to see the original image" />
</p>
<h4>See also</h4>
<p>
<a href="image1.html#affine_transform">affine_transform</a>, <a href="#flip_bang">flip!</a>, <a href="#flop">flop</a>,
<a href="image3.html#rotate">rotate</a>, <a href="image3.html#transpose">transpose</a>,
<a href="image3.html#transverse">transverse</a>
</p>
<h4>Magick API</h4>
<p>FlipImage</p>
</div>
<div class="sig">
<h3 id="flip_bang">flip!</h3>
<p><span class="arg">img</span>.flip! -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>In-place form of <a href="#flip">flip</a>.</p>
<h4>Returns</h4>
<p>self</p>
</div>
<div class="sig">
<h3 id="flop">flop</h3>
<p><span class="arg">img</span>.flop -> <em>image</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Create a horizontal mirror image of the receiver.</p>
<h4>Returns</h4>
<p>A new image</p>
<h4>Example</h4>
<p class="rollover">
<a href="javascript:popup('flop.rb.html')"
><img
onmouseover="this.src='ex/images/Flower_Hat.jpg'"
onmouseout="this.src='ex/flop.jpg'"
src="ex/flop.jpg"
alt="flop example"
title="Click to see the example script"
/></a>
<img src="ex/images/spin.gif" alt="" class="spin" title="Mouse over the example to see the original image" />
</p>
<h4>See also</h4>
<p>
<a href="image1.html#affine_transform">affine_transform</a>, <a href="#flip">flip</a>, <a href="#flop_bang">flop!</a>,
<a href="image3.html#rotate">rotate</a>, <a href="image3.html#transpose">transpose</a>,
<a href="image3.html#transverse">transverse</a>
</p>
<h4>Magick API</h4>
<p>FlopImage</p>
</div>
<div class="sig">
<h3 id="flop_bang">flop!</h3>
<p><span class="arg">img</span>.flop! -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>In-place form of <a href="#flop">flop</a>.</p>
<h4>Returns</h4>
<p>self</p>
</div>
<div class="sig">
<h3 id="frame">frame</h3>
<p>
<span class="arg">img</span>.frame(<span class="arg">width</span>=25, <span class="arg">height</span>=25, <span class="arg">x</span>=25,
<span class="arg">y</span>=25, <span class="arg">inner_bevel</span>=6, <span class="arg">outer_bevel</span>=6, <span class="arg">color</span>=<code
><a href="imageattrs.html#matte_color">matte_color</a></code
>) -> <em>image</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Adds a simulated 3D border.</p>
<h4>Arguments</h4>
<dl>
<dt>width</dt>
<dd>The width of the left and right sides.</dd>
<dt>height</dt>
<dd>The height of the top and bottom sides.</dd>