wiImage::applyFilter()
See:
List of operations
Signature
wiImage::applyFilter($filter, $arg1 = null, $arg2 = null, $arg3 = null)
Parameters
- $filter (int): the filter type.
- $arg1 .. $arg3 (int): Filter parameters.
- result (wiTrueColorImage): filtered image
Description
This method applies a filter to an image. See
imagefilter()∞ for details.
Notes
Some filters don't work on transparent and alpha-channel images.
Meaning and ranges of arguments
(copied from php.net comment by PanuWorld 14-Jan-2007 03:55)
IMG_FILTER_BRIGHTNESS
-255 = min brightness, 0 = no change, +255 = max brightness
IMG_FILTER_CONTRAST
-100 = max contrast, 0 = no change, +100 = min contrast (note the direction!)
IMG_FILTER_COLORIZE
Adds (subtracts) specified RGB values to each pixel. The valid range for each color is -255...+255, not 0...255. The correct order is red, green, blue.
-255 = min, 0 = no change, +255 = max
This has not much to do with IMG_FILTER_GRAYSCALE.
IMG_FILTER_SMOOTH
Applies a 9-cell convolution matrix where center pixel has the weight arg1 and others weight of 1.0. The result is normalized by dividing the sum with arg1 + 8.0 (sum of the matrix).
any float is accepted, large value (in practice: 2048 or more) = no change
Examples
$img = wiImage::load('/path/to/an/image.png');
// another way of grayscaling
$new = $img->applyFilter(IMG_FILTER_GRAYSCALE);
CategoryDocApi
There are no comments on this page. [Add comment]