Class Fleximage::Operator::UnsharpMask
In: lib/fleximage/operator/unsharp_mask.rb
Parent: Operator::Base

Sharpen an image using an unsharp mask filter.

  image.unsharp_mask(options = {})

Use the following keys in the options hash:

  • radius: The radius of the Gaussian operator. The default is 0.0.
  • sigma: The standard deviation of the Gaussian operator. A good starting value is 1.0, which is the default.
  • amount: The percentage of the blurred image to be added to the receiver, specified as a fraction between 0 and 1.0. A good starting value is 1.0, which is the default.
  • threshold: The threshold needed to apply the amount, specified as a fraction between 0 and 1.0. A good starting value is 0.05, which is the default.

Example:

  @photo.operate do |image|
    image.unsharp_mask
  end

Methods

operate  

Public Instance methods

[Source]

    # File lib/fleximage/operator/unsharp_mask.rb, line 21
21:       def operate(options = {})
22:         options = options.symbolize_keys if options.respond_to?(:symbolize_keys)
23:         options = {
24:           :radius    => 0.0,
25:           :sigma     => 1.0,
26:           :amount    => 1.0,
27:           :threshold => 0.05
28:         }.merge(options)
29: 
30:         # sharpen image
31:         @image = @image.unsharp_mask(options[:radius], options[:sigma], options[:amount], options[:threshold])
32:       end

[Validate]