Image effect callback; Desaturate (grayscale) an image resource.
$image: An image object returned by image_load().
$data: An array of attributes to use when performing the desaturate effect.
TRUE on success. FALSE on failure to desaturate image.
function image_desaturate_effect(&$image, $data) {
if (!image_desaturate($image)) {
watchdog('image', 'Image desaturate failed using the %toolkit toolkit on %path (%mimetype, %dimensions)', array(
'%toolkit' => $image->toolkit,
'%path' => $image->source,
'%mimetype' => $image->info['mime_type'],
'%dimensions' => $image->info['width'] . 'x' . $image->info['height'],
), WATCHDOG_ERROR);
return FALSE;
}
return TRUE;
}