Class: Magick::Image
- Inherits:
-
Object
- Object
- Magick::Image
- Includes:
- Comparable
- Defined in:
- lib/RMagick.rb,
ext/RMagick/rmmain.c
Overview
Ruby-level Magick::Image methods
Defined Under Namespace
Classes: DrawOptions, Info, PolaroidOptions, View
Class Method Summary collapse
- ._load ⇒ Object
- .capture ⇒ Object
- .combine ⇒ Object
- .constitute ⇒ Object
- .from_blob ⇒ Object
- .ping ⇒ Object
- .read ⇒ Object
- .read_inline ⇒ Object
Instance Method Summary collapse
- #<=> ⇒ Object
- #[] ⇒ Object
- #[]= ⇒ Object
- #_dump ⇒ Object
-
#adaptive_blur ⇒ Object
do not document! Only used by Image#iterations=.
- #adaptive_blur_channel ⇒ Object
- #adaptive_resize ⇒ Object
- #adaptive_sharpen ⇒ Object
- #adaptive_sharpen_channel ⇒ Object
- #adaptive_threshold ⇒ Object
- #add_compose_mask ⇒ Object
- #add_noise ⇒ Object
- #add_noise_channel ⇒ Object
- #add_profile ⇒ Object
- #affine_transform ⇒ Object
- #alpha ⇒ Object
- #alpha? ⇒ Boolean
-
#annotate(draw, width, height, x, y, text, &block) ⇒ Object
Provide an alternate version of Draw#annotate, for folks who want to find it in this class.
- #auto_orient ⇒ Object
- #auto_orient! ⇒ Object
- #bilevel_channel ⇒ Object
- #black_threshold ⇒ Object
- #blend ⇒ Object
- #blur_channel ⇒ Object
- #blur_image ⇒ Object
- #border ⇒ Object
- #border! ⇒ Object
- #change_geometry ⇒ Object
- #change_geometry! ⇒ Object
- #changed? ⇒ Boolean
- #channel ⇒ Object
-
#channel_compare ⇒ Object
An alias for compare_channel.
- #channel_depth ⇒ Object
- #channel_extrema ⇒ Object
- #channel_mean ⇒ Object
- #charcoal ⇒ Object
- #check_destroyed ⇒ Object
- #chop ⇒ Object
- #clone ⇒ Object
- #clut_channel ⇒ Object
-
#color_fill_to_border(x, y, fill) ⇒ Object
Set all pixels that are neighbors of x,y and are not the border color to the fill color.
- #color_flood_fill ⇒ Object
-
#color_floodfill(x, y, fill) ⇒ Object
Set all pixels that have the same color as the pixel at x,y and are neighbors to the fill color.
- #color_histogram ⇒ Object
-
#color_point(x, y, fill) ⇒ Object
Set the color at x,y.
-
#color_reset!(fill) ⇒ Object
Set all pixels to the fill color.
- #colorize ⇒ Object
- #colormap ⇒ Object
- #compare_channel ⇒ Object
- #composite ⇒ Object
- #composite! ⇒ Object
- #composite_affine ⇒ Object
- #composite_channel ⇒ Object
- #composite_channel! ⇒ Object
- #composite_tiled ⇒ Object
- #composite_tiled! ⇒ Object
- #compress_colormap! ⇒ Object
- #contrast ⇒ Object
- #contrast_stretch_channel ⇒ Object
- #convolve ⇒ Object
- #convolve_channel ⇒ Object
- #copy ⇒ Object
- #crop ⇒ Object
- #crop! ⇒ Object
-
#cur_image ⇒ Object
Used by ImageList methods - see ImageList#cur_image.
- #cycle_colormap ⇒ Object
- #decipher ⇒ Object
- #define ⇒ Object
- #delete_compose_mask ⇒ Object
- #delete_profile ⇒ Object
- #deskew ⇒ Object
- #despeckle ⇒ Object
- #destroy! ⇒ Object
- #destroyed? ⇒ Boolean
- #difference ⇒ Object
- #dispatch ⇒ Object
- #displace ⇒ Object
- #display ⇒ Object (also: #__display__)
- #dissolve ⇒ Object
- #distort ⇒ Object
- #distortion_channel ⇒ Object
- #dup ⇒ Object
-
#each_iptc_dataset ⇒ Object
Iterate over IPTC record number:dataset tags, yield for each non-nil dataset.
-
#each_pixel ⇒ Object
Thanks to Russell Norris!.
- #each_profile ⇒ Object
- #edge ⇒ Object
- #emboss ⇒ Object
- #encipher ⇒ Object
- #enhance ⇒ Object
- #equalize ⇒ Object
- #equalize_channel ⇒ Object
- #erase! ⇒ Object
- #excerpt ⇒ Object
- #excerpt! ⇒ Object
- #export_pixels ⇒ Object
- #export_pixels_to_str ⇒ Object
- #extent ⇒ Object
- #find_similar_region ⇒ Object
- #flip ⇒ Object
- #flip! ⇒ Object
- #flop ⇒ Object
- #flop! ⇒ Object
- #frame ⇒ Object
- #gamma_channel ⇒ Object
- #gamma_correct ⇒ Object
- #gaussian_blur ⇒ Object
- #gaussian_blur_channel ⇒ Object
-
#get_exif_by_entry(*entry) ⇒ Object
Retrieve EXIF data by entry or all.
-
#get_exif_by_number(*tag) ⇒ Object
Retrieve EXIF data by tag number or all tag/value pairs.
-
#get_iptc_dataset(ds) ⇒ Object
Retrieve IPTC information by record number:dataset tag constant defined in Magick::IPTC, above.
- #get_pixels ⇒ Object
- #gray? ⇒ Boolean
- #grey? ⇒ Boolean
- #histogram? ⇒ Boolean
- #implode ⇒ Object
- #import_pixels ⇒ Object
- #initialize ⇒ Object constructor
- #initialize_copy ⇒ Object
- #inspect ⇒ Object
-
#level(black_point = 0.0, white_point = nil, gamma = nil) ⇒ Object
(Thanks to Al Evans for the suggestion.).
- #level2 ⇒ Object
- #level_channel ⇒ Object
- #level_colors ⇒ Object
- #levelize_channel ⇒ Object
- #linear_stretch ⇒ Object
- #liquid_rescale ⇒ Object
- #magnify ⇒ Object
- #magnify! ⇒ Object
- #map ⇒ Object
- #mask ⇒ Object
-
#matte_fill_to_border(x, y) ⇒ Object
Make transparent any neighbor pixel that is not the border color.
- #matte_flood_fill ⇒ Object
-
#matte_floodfill(x, y) ⇒ Object
Make transparent any pixel that matches the color of the pixel at (x,y) and is a neighbor.
-
#matte_point(x, y) ⇒ Object
Make the pixel at (x,y) transparent.
-
#matte_replace(x, y) ⇒ Object
Make transparent all pixels that are the same color as the pixel at (x, y).
-
#matte_reset! ⇒ Object
Make all pixels transparent.
- #median_filter ⇒ Object
- #minify ⇒ Object
- #minify! ⇒ Object
- #modulate ⇒ Object
- #monochrome? ⇒ Boolean
- #motion_blur ⇒ Object
- #negate ⇒ Object
- #negate_channel ⇒ Object
- #normalize ⇒ Object
- #normalize_channel ⇒ Object
- #oil_paint ⇒ Object
- #opaque ⇒ Object
- #opaque? ⇒ Boolean
- #opaque_channel ⇒ Object
- #ordered_dither ⇒ Object
- #paint_transparent ⇒ Object
- #palette? ⇒ Boolean
- #pixel_color ⇒ Object
- #polaroid ⇒ Object
- #posterize ⇒ Object
-
#preview ⇒ Object
rb_define_method(Class_Image, “plasma”, Image_plasma, 6);.
- #profile! ⇒ Object
- #properties ⇒ Object
- #quantize ⇒ Object
- #quantum_operator ⇒ Object
- #radial_blur ⇒ Object
- #radial_blur_channel ⇒ Object
- #raise ⇒ Object
- #random_threshold_channel ⇒ Object
- #recolor ⇒ Object
- #reduce_noise ⇒ Object
- #remap ⇒ Object (also: #affinity)
-
#resample(x_res = 72.0, y_res = nil) ⇒ Object
Corresponds to ImageMagick’s -resample option.
- #resize ⇒ Object
- #resize! ⇒ Object
-
#resize_to_fill(ncols, nrows = nil, gravity = CenterGravity) ⇒ Object
(also: #crop_resized)
Force an image to exact dimensions without changing the aspect ratio.
- #resize_to_fill!(ncols, nrows = nil, gravity = CenterGravity) ⇒ Object (also: #crop_resized!)
-
#resize_to_fit(cols, rows = nil) ⇒ Object
Convenience method to resize retaining the aspect ratio.
- #resize_to_fit!(cols, rows = nil) ⇒ Object
- #roll ⇒ Object
- #rotate ⇒ Object
- #rotate! ⇒ Object
- #sample ⇒ Object
- #sample! ⇒ Object
- #scale ⇒ Object
- #scale! ⇒ Object
- #segment ⇒ Object
- #separate ⇒ Object
- #sepiatone ⇒ Object
- #set_channel_depth ⇒ Object
- #shade ⇒ Object
- #shadow ⇒ Object
- #sharpen ⇒ Object
- #sharpen_channel ⇒ Object
- #shave ⇒ Object
- #shave! ⇒ Object
- #shear ⇒ Object
- #sigmoidal_contrast_channel ⇒ Object
- #signature ⇒ Object
- #sketch ⇒ Object
- #solarize ⇒ Object
- #sparse_color ⇒ Object
- #splice ⇒ Object
- #spread ⇒ Object
- #stegano ⇒ Object
- #stereo ⇒ Object
- #store_pixels ⇒ Object
- #strip! ⇒ Object
- #swirl ⇒ Object
- #sync_profiles ⇒ Object
-
#texture_fill_to_border(x, y, texture) ⇒ Object
Replace neighboring pixels to border color with texture pixels.
- #texture_flood_fill ⇒ Object
-
#texture_floodfill(x, y, texture) ⇒ Object
Replace matching neighboring pixels with texture pixels.
- #threshold ⇒ Object
- #thumbnail ⇒ Object
- #thumbnail! ⇒ Object
- #tint ⇒ Object
- #to_blob ⇒ Object
- #to_color ⇒ Object
- #transparent ⇒ Object
- #transparent_chroma ⇒ Object
- #transpose ⇒ Object
- #transpose! ⇒ Object
- #transverse ⇒ Object
- #transverse! ⇒ Object
- #trim ⇒ Object
- #trim! ⇒ Object
- #undefine ⇒ Object
- #unique_colors ⇒ Object
- #unsharp_mask ⇒ Object
- #unsharp_mask_channel ⇒ Object
-
#view(x, y, width, height) ⇒ Object
Construct a view.
- #vignette ⇒ Object
- #watermark ⇒ Object
- #wave ⇒ Object
- #wet_floor ⇒ Object
- #white_threshold ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize ⇒ Object
Class Method Details
._load ⇒ Object
.capture ⇒ Object
.combine ⇒ Object
.constitute ⇒ Object
.from_blob ⇒ Object
.ping ⇒ Object
.read ⇒ Object
.read_inline ⇒ Object
Instance Method Details
#<=> ⇒ Object
#[] ⇒ Object
#[]= ⇒ Object
#_dump ⇒ Object
#adaptive_blur ⇒ Object
do not document! Only used by Image#iterations=
#adaptive_blur_channel ⇒ Object
#adaptive_resize ⇒ Object
#adaptive_sharpen ⇒ Object
#adaptive_sharpen_channel ⇒ Object
#adaptive_threshold ⇒ Object
#add_compose_mask ⇒ Object
#add_noise ⇒ Object
#add_noise_channel ⇒ Object
#add_profile ⇒ Object
#affine_transform ⇒ Object
#alpha ⇒ Object
#alpha? ⇒ Boolean
#annotate(draw, width, height, x, y, text, &block) ⇒ Object
Provide an alternate version of Draw#annotate, for folks who want to find it in this class.
741 742 743 744 745 |
# File 'lib/RMagick.rb', line 741 def annotate(draw, width, height, x, y, text, &block) check_destroyed draw.annotate(self, width, height, x, y, text, &block) self end |
#auto_orient ⇒ Object
#auto_orient! ⇒ Object
#bilevel_channel ⇒ Object
#black_threshold ⇒ Object
#blend ⇒ Object
#blur_channel ⇒ Object
#blur_image ⇒ Object
#border ⇒ Object
#border! ⇒ Object
#change_geometry ⇒ Object
#change_geometry! ⇒ Object
#changed? ⇒ Boolean
#channel ⇒ Object
#channel_compare ⇒ Object
An alias for compare_channel
#channel_depth ⇒ Object
#channel_extrema ⇒ Object
#channel_mean ⇒ Object
#charcoal ⇒ Object
#check_destroyed ⇒ Object
#chop ⇒ Object
#clone ⇒ Object
#clut_channel ⇒ Object
#color_fill_to_border(x, y, fill) ⇒ Object
Set all pixels that are neighbors of x,y and are not the border color to the fill color
763 764 765 |
# File 'lib/RMagick.rb', line 763 def color_fill_to_border(x, y, fill) color_flood_fill(border_color, fill, x, y, Magick::FillToBorderMethod) end |
#color_flood_fill ⇒ Object
#color_floodfill(x, y, fill) ⇒ Object
Set all pixels that have the same color as the pixel at x,y and are neighbors to the fill color
756 757 758 759 |
# File 'lib/RMagick.rb', line 756 def color_floodfill(x, y, fill) target = pixel_color(x, y) color_flood_fill(target, fill, x, y, Magick::FloodfillMethod) end |
#color_histogram ⇒ Object
#color_point(x, y, fill) ⇒ Object
Set the color at x,y
748 749 750 751 752 |
# File 'lib/RMagick.rb', line 748 def color_point(x, y, fill) f = copy f.pixel_color(x, y, fill) return f end |
#color_reset!(fill) ⇒ Object
Set all pixels to the fill color. Very similar to Image#erase! Accepts either String or Pixel arguments
769 770 771 772 773 774 775 776 777 778 779 780 781 |
# File 'lib/RMagick.rb', line 769 def color_reset!(fill) save = background_color # Change the background color _outside_ the begin block # so that if this object is frozen the exeception will be # raised before we have to handle it explicitly. self.background_color = fill begin erase! ensure self.background_color = save end self end |
#colorize ⇒ Object
#colormap ⇒ Object
#compare_channel ⇒ Object
#composite ⇒ Object
#composite! ⇒ Object
#composite_affine ⇒ Object
#composite_channel ⇒ Object
#composite_channel! ⇒ Object
#composite_tiled ⇒ Object
#composite_tiled! ⇒ Object
#compress_colormap! ⇒ Object
#contrast ⇒ Object
#contrast_stretch_channel ⇒ Object
#convolve ⇒ Object
#convolve_channel ⇒ Object
#copy ⇒ Object
#crop ⇒ Object
#crop! ⇒ Object
#cur_image ⇒ Object
Used by ImageList methods - see ImageList#cur_image
784 785 786 |
# File 'lib/RMagick.rb', line 784 def cur_image self end |
#cycle_colormap ⇒ Object
#decipher ⇒ Object
#define ⇒ Object
#delete_compose_mask ⇒ Object
#delete_profile ⇒ Object
#deskew ⇒ Object
#despeckle ⇒ Object
#destroy! ⇒ Object
#destroyed? ⇒ Boolean
#difference ⇒ Object
#dispatch ⇒ Object
#displace ⇒ Object
#display ⇒ Object Also known as: __display__
#dissolve ⇒ Object
#distort ⇒ Object
#distortion_channel ⇒ Object
#dup ⇒ Object
#each_iptc_dataset ⇒ Object
Iterate over IPTC record number:dataset tags, yield for each non-nil dataset
846 847 848 849 850 851 852 853 854 855 |
# File 'lib/RMagick.rb', line 846 def each_iptc_dataset Magick::IPTC.constants.each do |record| rec = Magick::IPTC.const_get(record) rec.constants.each do |dataset| data_field = get_iptc_dataset(rec.const_get(dataset)) yield(dataset, data_field) unless data_field.nil? end end nil end |
#each_pixel ⇒ Object
Thanks to Russell Norris!
789 790 791 792 793 794 |
# File 'lib/RMagick.rb', line 789 def each_pixel get_pixels(0, 0, columns, rows).each_with_index do |p, n| yield(p, n%columns, n/columns) end self end |
#each_profile ⇒ Object
#edge ⇒ Object
#emboss ⇒ Object
#encipher ⇒ Object
#enhance ⇒ Object
#equalize ⇒ Object
#equalize_channel ⇒ Object
#erase! ⇒ Object
#excerpt ⇒ Object
#excerpt! ⇒ Object
#export_pixels ⇒ Object
#export_pixels_to_str ⇒ Object
#extent ⇒ Object
#find_similar_region ⇒ Object
#flip ⇒ Object
#flip! ⇒ Object
#flop ⇒ Object
#flop! ⇒ Object
#frame ⇒ Object
#gamma_channel ⇒ Object
#gamma_correct ⇒ Object
#gaussian_blur ⇒ Object
#gaussian_blur_channel ⇒ Object
#get_exif_by_entry(*entry) ⇒ Object
Retrieve EXIF data by entry or all. If one or more entry names specified, return the values associated with the entries. If no entries specified, return all entries and values. The return value is an array of [name,value] arrays.
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
# File 'lib/RMagick.rb', line 800 def get_exif_by_entry(*entry) ary = Array.new if entry.length == 0 exif_data = self['EXIF:*'] if exif_data exif_data.split("\n").each { |exif| ary.push(exif.split('=')) } end else get_exif_by_entry() # ensure properties is populated with exif data entry.each do |name| rval = self["EXIF:#{name}"] ary.push([name, rval]) end end return ary end |
#get_exif_by_number(*tag) ⇒ Object
Retrieve EXIF data by tag number or all tag/value pairs. The return value is a hash.
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 |
# File 'lib/RMagick.rb', line 818 def get_exif_by_number(*tag) hash = Hash.new if tag.length == 0 exif_data = self['EXIF:!'] if exif_data exif_data.split("\n").each do |exif| tag, value = exif.split('=') tag = tag[1,4].hex hash[tag] = value end end else get_exif_by_number() # ensure properties is populated with exif data tag.each do |num| rval = self['#%04X' % num.to_i] hash[num] = rval == 'unknown' ? nil : rval end end return hash end |
#get_iptc_dataset(ds) ⇒ Object
Retrieve IPTC information by record number:dataset tag constant defined in Magick::IPTC, above.
841 842 843 |
# File 'lib/RMagick.rb', line 841 def get_iptc_dataset(ds) self['IPTC:'+ds] end |
#get_pixels ⇒ Object
#gray? ⇒ Boolean
#grey? ⇒ Boolean
#histogram? ⇒ Boolean
#implode ⇒ Object
#import_pixels ⇒ Object
#initialize_copy ⇒ Object
#inspect ⇒ Object
#level(black_point = 0.0, white_point = nil, gamma = nil) ⇒ Object
(Thanks to Al Evans for the suggestion.)
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
# File 'lib/RMagick.rb', line 870 def level(black_point=0.0, white_point=nil, gamma=nil) black_point = Float(black_point) white_point ||= Magick::QuantumRange - black_point white_point = Float(white_point) gamma_arg = gamma gamma ||= 1.0 gamma = Float(gamma) if gamma.abs > 10.0 || white_point.abs <= 10.0 || white_point.abs < gamma.abs gamma, white_point = white_point, gamma unless gamma_arg white_point = Magick::QuantumRange - black_point end end return level2(black_point, white_point, gamma) end |
#level2 ⇒ Object
#level_channel ⇒ Object
#level_colors ⇒ Object
#levelize_channel ⇒ Object
#linear_stretch ⇒ Object
#liquid_rescale ⇒ Object
#magnify ⇒ Object
#magnify! ⇒ Object
#map ⇒ Object
#mask ⇒ Object
#matte_fill_to_border(x, y) ⇒ Object
Make transparent any neighbor pixel that is not the border color.
924 925 926 927 928 929 |
# File 'lib/RMagick.rb', line 924 def matte_fill_to_border(x, y) f = copy f.opacity = Magick::OpaqueOpacity unless f.matte f.matte_flood_fill(border_color, TransparentOpacity, x, y, FillToBorderMethod) end |
#matte_flood_fill ⇒ Object
#matte_floodfill(x, y) ⇒ Object
Make transparent any pixel that matches the color of the pixel at (x,y) and is a neighbor.
915 916 917 918 919 920 921 |
# File 'lib/RMagick.rb', line 915 def matte_floodfill(x, y) f = copy f.opacity = OpaqueOpacity unless f.matte target = f.pixel_color(x, y) f.matte_flood_fill(target, TransparentOpacity, x, y, FloodfillMethod) end |
#matte_point(x, y) ⇒ Object
Make the pixel at (x,y) transparent.
895 896 897 898 899 900 901 902 |
# File 'lib/RMagick.rb', line 895 def matte_point(x, y) f = copy f.opacity = OpaqueOpacity unless f.matte pixel = f.pixel_color(x,y) pixel.opacity = TransparentOpacity f.pixel_color(x, y, pixel) return f end |
#matte_replace(x, y) ⇒ Object
Make transparent all pixels that are the same color as the pixel at (x, y).
906 907 908 909 910 911 |
# File 'lib/RMagick.rb', line 906 def matte_replace(x, y) f = copy f.opacity = OpaqueOpacity unless f.matte target = f.pixel_color(x, y) f.transparent(target) end |
#matte_reset! ⇒ Object
Make all pixels transparent.
932 933 934 935 |
# File 'lib/RMagick.rb', line 932 def matte_reset! self.opacity = Magick::TransparentOpacity self end |
#median_filter ⇒ Object
#minify ⇒ Object
#minify! ⇒ Object
#modulate ⇒ Object
#monochrome? ⇒ Boolean
#motion_blur ⇒ Object
#negate ⇒ Object
#negate_channel ⇒ Object
#normalize ⇒ Object
#normalize_channel ⇒ Object
#oil_paint ⇒ Object
#opaque ⇒ Object
#opaque? ⇒ Boolean
#opaque_channel ⇒ Object
#ordered_dither ⇒ Object
#paint_transparent ⇒ Object
#palette? ⇒ Boolean
#pixel_color ⇒ Object
#polaroid ⇒ Object
#posterize ⇒ Object
#preview ⇒ Object
rb_define_method(Class_Image, “plasma”, Image_plasma, 6);
#profile! ⇒ Object
#properties ⇒ Object
#quantize ⇒ Object
#quantum_operator ⇒ Object
#radial_blur ⇒ Object
#radial_blur_channel ⇒ Object
#raise ⇒ Object
#random_threshold_channel ⇒ Object
#recolor ⇒ Object
#reduce_noise ⇒ Object
#remap ⇒ Object Also known as: affinity
#resample(x_res = 72.0, y_res = nil) ⇒ Object
Corresponds to ImageMagick’s -resample option
938 939 940 941 942 943 944 945 |
# File 'lib/RMagick.rb', line 938 def resample(x_res=72.0, y_res=nil) y_res ||= x_res width = x_res * columns / x_resolution + 0.5 height = y_res * rows / y_resolution + 0.5 self.x_resolution = x_res self.y_resolution = y_res resize(width, height) end |
#resize ⇒ Object
#resize! ⇒ Object
#resize_to_fill(ncols, nrows = nil, gravity = CenterGravity) ⇒ Object Also known as: crop_resized
Force an image to exact dimensions without changing the aspect ratio. Resize and crop if necessary. (Thanks to Jerett Taylor!)
949 950 951 |
# File 'lib/RMagick.rb', line 949 def resize_to_fill(ncols, nrows=nil, gravity=CenterGravity) copy.resize_to_fill!(ncols, nrows, gravity) end |
#resize_to_fill!(ncols, nrows = nil, gravity = CenterGravity) ⇒ Object Also known as: crop_resized!
953 954 955 956 957 958 959 960 961 |
# File 'lib/RMagick.rb', line 953 def resize_to_fill!(ncols, nrows=nil, gravity=CenterGravity) nrows ||= ncols if ncols != columns || nrows != rows scale = [ncols/columns.to_f, nrows/rows.to_f].max resize!(scale*columns+0.5, scale*rows+0.5) end crop!(gravity, ncols, nrows, true) if ncols != columns || nrows != rows self end |
#resize_to_fit(cols, rows = nil) ⇒ Object
Convenience method to resize retaining the aspect ratio. (Thanks to Robert Manni!)
969 970 971 972 973 974 |
# File 'lib/RMagick.rb', line 969 def resize_to_fit(cols, rows=nil) rows ||= cols change_geometry(Geometry.new(cols, rows)) do |ncols, nrows| resize(ncols, nrows) end end |
#resize_to_fit!(cols, rows = nil) ⇒ Object
976 977 978 979 980 981 |
# File 'lib/RMagick.rb', line 976 def resize_to_fit!(cols, rows=nil) rows ||= cols change_geometry(Geometry.new(cols, rows)) do |ncols, nrows| resize!(ncols, nrows) end end |
#roll ⇒ Object
#rotate ⇒ Object
#rotate! ⇒ Object
#sample ⇒ Object
#sample! ⇒ Object
#scale ⇒ Object
#scale! ⇒ Object
#segment ⇒ Object
#separate ⇒ Object
#sepiatone ⇒ Object
#set_channel_depth ⇒ Object
#shade ⇒ Object
#shadow ⇒ Object
#sharpen ⇒ Object
#sharpen_channel ⇒ Object
#shave ⇒ Object
#shave! ⇒ Object
#shear ⇒ Object
#sigmoidal_contrast_channel ⇒ Object
#signature ⇒ Object
#sketch ⇒ Object
#solarize ⇒ Object
#sparse_color ⇒ Object
#splice ⇒ Object
#spread ⇒ Object
#stegano ⇒ Object
#stereo ⇒ Object
#store_pixels ⇒ Object
#strip! ⇒ Object
#swirl ⇒ Object
#sync_profiles ⇒ Object
#texture_fill_to_border(x, y, texture) ⇒ Object
Replace neighboring pixels to border color with texture pixels
990 991 992 |
# File 'lib/RMagick.rb', line 990 def texture_fill_to_border(x, y, texture) texture_flood_fill(border_color, texture, x, y, FillToBorderMethod) end |
#texture_flood_fill ⇒ Object
#texture_floodfill(x, y, texture) ⇒ Object
Replace matching neighboring pixels with texture pixels
984 985 986 987 |
# File 'lib/RMagick.rb', line 984 def texture_floodfill(x, y, texture) target = pixel_color(x, y) texture_flood_fill(target, texture, x, y, FloodfillMethod) end |
#threshold ⇒ Object
#thumbnail ⇒ Object
#thumbnail! ⇒ Object
#tint ⇒ Object
#to_blob ⇒ Object
#to_color ⇒ Object
#transparent ⇒ Object
#transparent_chroma ⇒ Object
#transpose ⇒ Object
#transpose! ⇒ Object
#transverse ⇒ Object
#transverse! ⇒ Object
#trim ⇒ Object
#trim! ⇒ Object
#undefine ⇒ Object
#unique_colors ⇒ Object
#unsharp_mask ⇒ Object
#unsharp_mask_channel ⇒ Object
#view(x, y, width, height) ⇒ Object
Construct a view. If a block is present, yield and pass the view object, otherwise return the view object.
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
# File 'lib/RMagick.rb', line 996 def view(x, y, width, height) view = View.new(self, x, y, width, height) if block_given? begin yield(view) ensure view.sync end return nil else return view end end |