- brightness :: Image -> Int -> IO ()
- colorize :: Image -> RGBA -> IO ()
- contrast :: Image -> Int -> IO ()
- gaussianBlur :: Image -> IO ()
- grayscale :: Image -> IO ()
- edgeDetect :: Image -> IO ()
- emboss :: Image -> IO ()
- meanRemoval :: Image -> IO ()
- negative :: Image -> IO ()
- smoothing :: Image -> Float -> IO ()
- pixelTransform :: Image -> (RGBA -> RGBA) -> IO ()
- convolute :: Image -> [[Float]] -> Float -> Float -> IO ()
Filters
brightness :: Image -> Int -> IO ()Source
Applies the supplied brightness adjustment to the image. The range of the brightness argument is -255 to +255
colorize :: Image -> RGBA -> IO ()Source
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.
contrast :: Image -> Int -> IO ()Source
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
gaussianBlur :: Image -> IO ()Source
Applies Gaussian blur to the image
edgeDetect :: Image -> IO ()Source
Applies Edge Detection to the image
meanRemoval :: Image -> IO ()Source
Applies a Mean Removal effect to the image
smoothing :: Image -> Float -> IO ()Source
Applies weighted Smoothing to the image. The smoothing amount is technically unbounded, but larger values produce a less noticeable result
Pixel transformation functions
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))
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