Method: Magick::Image#threshold
- Defined in:
- ext/RMagick/rmimage.cpp
#threshold(threshold_obj) ⇒ Magick::Image
Change the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image.
14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 |
# File 'ext/RMagick/rmimage.cpp', line 14162
VALUE
Image_threshold(VALUE self, VALUE threshold_obj)
{
Image *image, *new_image;
double threshold = NUM2DBL(threshold_obj);
#if defined(IMAGEMAGICK_7)
ExceptionInfo *exception;
#endif
image = rm_check_destroyed(self);
new_image = rm_clone_image(image);
#if defined(IMAGEMAGICK_7)
exception = AcquireExceptionInfo();
GVL_STRUCT_TYPE(BilevelImage) args = { new_image, threshold, exception };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BilevelImage), &args);
rm_check_exception(exception, new_image, DestroyOnError);
DestroyExceptionInfo(exception);
#else
GVL_STRUCT_TYPE(BilevelImageChannel) args = { new_image, DefaultChannels, threshold };
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BilevelImageChannel), &args);
rm_check_image_exception(new_image, DestroyOnError);
#endif
return rm_image_new(new_image);
}
|