View source
<?php
function image_imagick_sharpen(stdClass $image, $radius, $sigma, $amount, $threshold) {
return $image->resource
->unsharpMaskImage($radius, $sigma, $amount, $threshold);
}
function imagick_sharpen($image, $data = array()) {
image_toolkit_invoke('sharpen', $image, $data);
}
function imagick_sharpen_form($data) {
$data = array_merge(imagick_sharpen_defaults(), (array) $data);
$form['radius'] = array(
'#type' => 'textfield',
'#title' => t('Radius'),
'#description' => t('The radius of the Gaussian, in pixels, not counting the center pixel. Default is 0 which is auto-select.'),
'#default_value' => $data['radius'],
'#size' => 3,
);
$form['sigma'] = array(
'#type' => 'textfield',
'#title' => t('Sigma'),
'#description' => t('The standard deviation of the Gaussian, in pixels. Default is 1.0.'),
'#default_value' => $data['sigma'],
'#size' => 3,
);
$form['amount'] = array(
'#type' => 'textfield',
'#title' => t('Amount'),
'#description' => t('The fraction of the difference between the original and the blur image that is added back into the original. Default is 1.0.'),
'#default_value' => $data['amount'],
'#size' => 3,
);
$form['threshold'] = array(
'#type' => 'textfield',
'#title' => t('Threshold'),
'#description' => t('The threshold, as a fraction of QuantumRange, needed to apply the difference amount. Default is 0.05.'),
'#default_value' => $data['threshold'],
'#size' => 3,
);
return $form;
}
function imagick_sharpen_defaults() {
return array(
'radius' => '0',
'sigma' => '1.0',
'amount' => '1.0',
'threshold' => '0.05',
);
}