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
Class Method Summary collapse
- ._load ⇒ Object
- .capture ⇒ Object
- .constitute ⇒ Object
- .from_blob ⇒ Object
- .new ⇒ Object
- .ping ⇒ Object
- .read ⇒ Object
- .read_inline ⇒ Object
Instance Method Summary collapse
- #<=> ⇒ Object
- #[] ⇒ Object
- #[]= ⇒ Object
- #_dump ⇒ Object
-
#adaptive_threshold ⇒ Object
do not document! Only used by Image#iterations=.
- #add_noise ⇒ Object
- #affine_transform ⇒ Object
-
#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.
- #bilevel_channel ⇒ Object
- #black_threshold ⇒ 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
- #channel_threshold ⇒ Object
- #charcoal ⇒ Object
- #chop ⇒ Object
- #clone ⇒ 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
- #compress_colormap! ⇒ Object
- #contrast ⇒ 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
- #despeckle ⇒ Object
- #difference ⇒ Object
- #dispatch ⇒ Object
- #display ⇒ Object (also: #__display__)
- #dup ⇒ Object
- #each_profile ⇒ Object
- #edge ⇒ Object
- #emboss ⇒ Object
- #enhance ⇒ Object
- #equalize ⇒ Object
- #erase! ⇒ Object
- #export_pixels ⇒ 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_pixels ⇒ Object
- #gray? ⇒ Boolean
- #grayscale_pseudo_class ⇒ Object
- #grey? ⇒ Boolean
- #implode ⇒ Object
- #import_pixels ⇒ Object
- #initialize ⇒ Object constructor
- #initialize_copy ⇒ Object
- #inspect ⇒ Object
- #level ⇒ Object
- #level_channel ⇒ Object
- #magnify ⇒ Object
- #magnify! ⇒ Object
- #map ⇒ 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
- #ordered_dither ⇒ Object
- #palette? ⇒ Boolean
- #pixel_color ⇒ 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
- #raise ⇒ Object
- #random_channel_threshold ⇒ Object
- #random_threshold_channel ⇒ Object
- #reduce_noise ⇒ Object
- #resize ⇒ Object
- #resize! ⇒ Object
- #roll ⇒ Object
- #rotate ⇒ Object
- #rotate! ⇒ Object
- #sample ⇒ Object
- #sample! ⇒ Object
- #scale ⇒ Object
- #scale! ⇒ Object
- #segment ⇒ Object
- #set_channel_depth ⇒ Object
- #shade ⇒ Object
- #sharpen ⇒ Object
- #sharpen_channel ⇒ Object
- #shave ⇒ Object
- #shave! ⇒ Object
- #shear ⇒ Object
- #signature ⇒ Object
- #solarize ⇒ Object
- #splice ⇒ Object
- #spread ⇒ Object
- #statistics ⇒ Object
- #stegano ⇒ Object
- #stereo ⇒ Object
- #store_pixels ⇒ Object
- #strip! ⇒ Object
- #swirl ⇒ 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
- #trim ⇒ Object
- #trim! ⇒ Object
- #unsharp_mask ⇒ Object
- #unsharp_mask_channel ⇒ Object
-
#view(x, y, width, height) ⇒ Object
Construct a view.
- #wave ⇒ Object
- #white_threshold ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize ⇒ Object
Class Method Details
._load ⇒ Object
.capture ⇒ Object
.constitute ⇒ Object
.from_blob ⇒ Object
.new ⇒ Object
.ping ⇒ Object
.read ⇒ Object
.read_inline ⇒ Object
Instance Method Details
#<=> ⇒ Object
#[] ⇒ Object
#[]= ⇒ Object
#_dump ⇒ Object
#adaptive_threshold ⇒ Object
do not document! Only used by Image#iterations=
#add_noise ⇒ Object
#affine_transform ⇒ Object
#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.
578 579 580 581 |
# File 'lib/RMagick.rb', line 578 def annotate(draw, width, height, x, y, text, &block) draw.annotate(self, width, height, x, y, text, &block) self end |
#bilevel_channel ⇒ Object
#black_threshold ⇒ 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
#channel_threshold ⇒ Object
#charcoal ⇒ Object
#chop ⇒ Object
#clone ⇒ 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
599 600 601 |
# File 'lib/RMagick.rb', line 599 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
592 593 594 595 |
# File 'lib/RMagick.rb', line 592 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
584 585 586 587 588 |
# File 'lib/RMagick.rb', line 584 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
605 606 607 608 609 610 611 612 613 614 615 616 617 |
# File 'lib/RMagick.rb', line 605 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
#compress_colormap! ⇒ Object
#contrast ⇒ Object
#convolve ⇒ Object
#convolve_channel ⇒ Object
#copy ⇒ Object
#crop ⇒ Object
#crop! ⇒ Object
#cur_image ⇒ Object
Used by ImageList methods - see ImageList#cur_image
620 621 622 |
# File 'lib/RMagick.rb', line 620 def cur_image self end |
#cycle_colormap ⇒ Object
#despeckle ⇒ Object
#difference ⇒ Object
#dispatch ⇒ Object
#display ⇒ Object Also known as: __display__
#dup ⇒ Object
#each_profile ⇒ Object
#edge ⇒ Object
#emboss ⇒ Object
#enhance ⇒ Object
#equalize ⇒ Object
#erase! ⇒ Object
#export_pixels ⇒ 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.
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 |
# File 'lib/RMagick.rb', line 685 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 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.
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 |
# File 'lib/RMagick.rb', line 702 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 tag.each do |num| rval = self["EXIF:#{'#%04X' % num}"] hash[num] = rval == 'unknown' ? nil : rval end end return hash end |
#get_pixels ⇒ Object
#gray? ⇒ Boolean
#grayscale_pseudo_class ⇒ Object
#grey? ⇒ Boolean
#implode ⇒ Object
#import_pixels ⇒ Object
#initialize_copy ⇒ Object
#inspect ⇒ Object
#level ⇒ Object
#level_channel ⇒ Object
#magnify ⇒ Object
#magnify! ⇒ Object
#map ⇒ Object
#matte_fill_to_border(x, y) ⇒ Object
Make transparent any neighbor pixel that is not the border color.
658 659 660 661 662 663 |
# File 'lib/RMagick.rb', line 658 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.
649 650 651 652 653 654 655 |
# File 'lib/RMagick.rb', line 649 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.
629 630 631 632 633 634 635 636 |
# File 'lib/RMagick.rb', line 629 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).
640 641 642 643 644 645 |
# File 'lib/RMagick.rb', line 640 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.
666 667 668 |
# File 'lib/RMagick.rb', line 666 def matte_reset! self.opacity = Magick::TransparentOpacity 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
#ordered_dither ⇒ Object
#palette? ⇒ Boolean
#pixel_color ⇒ 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
#raise ⇒ Object
#random_channel_threshold ⇒ Object
#random_threshold_channel ⇒ Object
#reduce_noise ⇒ Object
#resize ⇒ Object
#resize! ⇒ Object
#roll ⇒ Object
#rotate ⇒ Object
#rotate! ⇒ Object
#sample ⇒ Object
#sample! ⇒ Object
#scale ⇒ Object
#scale! ⇒ Object
#segment ⇒ Object
#set_channel_depth ⇒ Object
#shade ⇒ Object
#sharpen ⇒ Object
#sharpen_channel ⇒ Object
#shave ⇒ Object
#shave! ⇒ Object
#shear ⇒ Object
#signature ⇒ Object
#solarize ⇒ Object
#splice ⇒ Object
#spread ⇒ Object
#statistics ⇒ Object
#stegano ⇒ Object
#stereo ⇒ Object
#store_pixels ⇒ Object
#strip! ⇒ Object
#swirl ⇒ Object
#texture_fill_to_border(x, y, texture) ⇒ Object
Replace neighboring pixels to border color with texture pixels
677 678 679 |
# File 'lib/RMagick.rb', line 677 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
671 672 673 674 |
# File 'lib/RMagick.rb', line 671 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
#trim ⇒ Object
#trim! ⇒ 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.
724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
# File 'lib/RMagick.rb', line 724 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 |