/usr/share/php/Horde/Image/Effect/Im/Unsharpmask.php is in php-horde-image 2.1.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <?php
/**
* Image effect for applying an unsharpmask.
*
* Copyright 2010-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Image
*/
class Horde_Image_Effect_Im_Unsharpmask extends Horde_Image_Effect
{
/**
*
* Valid parameters:
*
* (float)radius - Thickness of the sharpened edge. Should be greater then
* sigma (or 0, and imagick will attempt to auto choose).
* In general, radius should be roughly output dpi / 150.
* So for display purposes a radius of 0.5 is suggested.
*
* (float)amount - Amount of the difference between original and the
* blur image that gets added back to the original. Can be
* thought of as the "strength" of the effect. Too high
* may cause blocking of shadows and highlights. Given
* a decimal value indicating percentage, e.g. 1.2 = 120%
*
* (float)threshold - Determines how large the brightness delta between
* adjacent pixels needs to be to sharpen the edge.
* Larger values == less sharpening. Useful for
* preventing noisy images from being oversharpened.
*
* (integer)channel - Which channel to apply the sharpening to.
*
* @var array
*/
protected $_params = array('radius' => 0.5,
'amount' => 1,
'threshold' => 0.05);
public function apply()
{
/* Calculate appropriate sigma:
* Determines how the sharpening is graduated away from
* the center pixel of the sharpened edge. In general,
* if radius < 1, then sigma = radius else sigma = sqrt(radius)
*/
$this->_params['sigma'] = ($this->_params['radius'] < 1) ?
$this->_params['radius'] : sqrt($this->_params['radius']);
$this->_image->addPostSrcOperation("-unsharp {$this->_params['radius']}x{$this->_params['sigma']}+{$this->_params['amount']}+{$this->_params['threshold']}");
return true;
}
}
|