imagefilters-0.1: Image Filters (contrast, brightness, gaussian blur, etc)

Graphics.Filters.GD

Synopsis

# Filters

Applies the supplied brightness adjustment to the image. The range of the brightness argument is -255 to +255

Applies the supplied color transformation to the image. The range of the passed RGB values are -255 to +255, and the range of the A value is -127 to +127.

Applies the supplied contrast adjustment to the image. The range of the contrast argument is -100 to +100, with -100 being maximum contrast, and +100 being minimum contrast

Applies Gaussian blur to the image

Converts an image to grayscale

Applies Edge Detection to the image

Applies an Emboss effect to the image

Applies a Mean Removal effect to the image

Inverts the image's color.

Applies weighted Smoothing to the image. The smoothing amount is technically unbounded, but larger values produce a less noticeable result

# Pixel transformation functions

Arguments

 :: Image -> (RGBA -> RGBA) Transform function to be performed on each pixel -> IO ()

Performs the supplied transform function on every pixel of the image. The transform function should take as it's argument a quadruple of Ints (RGBA) and returns a new RGBA quadruple which is will be the new RGBA values of the the pixel.

For example, the `colorize` filter's inner workings are implemented with this as the transform function:

```      (\(r,g,b,a) -> let
nr = clamp 0 255 (r+ar)
ng = clamp 0 255 (g+ag)
nb = clamp 0 255 (b+ab)
na = clamp 0 127 (a+aa)
in (nr,ng,nb,na))
```

Arguments

 :: Image -> [[Float]] Convolution matrix -> Float Divisor -> Float Offset -> IO ()

Performs the convolution matrix on each pixel of the original image. After the matrix has been applied, the resulting RGBA value has each of it's elements divided by the Divisor argument and then the Offset argument is added to each element

For example, the `emboss` filter is implemented with the following convolution:

```   emboss img = convolute img [[1.5,0.0,0.0],[0.0,0.0,0.0],[0.0,0.0,-1.5]] 1 127
```