Method: Magick::Image#unsharp_mask

Defined in:
ext/RMagick/rmimage.cpp

#unsharp_mask(radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05) ⇒ Magick::Image

Sharpen an image. “amount” is the percentage of the difference between the original and the blur image that is added back into the original. “threshold” is the threshold in pixels needed to apply the diffence amount.

Returns a new image.

Parameters:

  • radius (Numeric) (defaults to: 0.0)

    The radius of the Gaussian operator.

  • sigma (Numeric) (defaults to: 1.0)

    The standard deviation of the Gaussian operator.

  • amount (Numeric) (defaults to: 1.0)

    The percentage of the blurred image to be added to the receiver, specified as a fraction between 0 and 1.0

  • threshold (Numeric) (defaults to: 0.05)

    The threshold needed to apply the amount, specified as a fraction between 0 and 1.0

Returns:



15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
# File 'ext/RMagick/rmimage.cpp', line 15285

VALUE
Image_unsharp_mask(int argc, VALUE *argv, VALUE self)
{
    Image *image, *new_image;
    double radius = 0.0, sigma = 1.0, amount = 1.0, threshold = 0.05;
    ExceptionInfo *exception;

    image = rm_check_destroyed(self);

    unsharp_mask_args(argc, argv, &radius, &sigma, &amount, &threshold);

    exception = AcquireExceptionInfo();
    GVL_STRUCT_TYPE(UnsharpMaskImage) args = { image, radius, sigma, amount, threshold, exception };
    new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnsharpMaskImage), &args);
    rm_check_exception(exception, new_image, DestroyOnError);
    DestroyExceptionInfo(exception);

    return rm_image_new(new_image);
}