Method: Magick::Image#contrast
- Defined in:
- ext/RMagick/rmimage.c
#contrast(*args) ⇒ Object
Enhance the intensity differences between the lighter and darker elements of the image. Set sharpen to “true” to increase the image contrast otherwise the contrast is reduced.
Ruby usage:
- @verbatim Image#contrast @endverbatim
- @verbatim Image#contrast(sharpen) @endverbatim
Notes:
- Default sharpen is 0
3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 |
# File 'ext/RMagick/rmimage.c', line 3954
VALUE
Image_contrast(int argc, VALUE *argv, VALUE self)
{
Image *image, *new_image;
unsigned int sharpen = 0;
image = rm_check_destroyed(self);
if (argc > 1)
{
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 or 1)", argc);
}
else if (argc == 1)
{
sharpen = RTEST(argv[0]);
}
new_image = rm_clone_image(image);
(void) ContrastImage(new_image, sharpen);
rm_check_image_exception(new_image, DestroyOnError);
return rm_image_new(new_image);
}
|