DevIL Logo
      A full featured cross-platform image library.


About

News

Download

SourceForge Home

Documentation
Tutorials

Logos

Links

Projects

Contact Us

Tutorial 8: ILU Filters and EffectsLast Revised: 9:35 PM 12/09/2000
ILU contains several filters for modifying images. Most filters are simple convolution filters, though others are present. Currently, ilu does not have any image matrix functionality equivalent to OpenGL's texture matrix, but it may in a future version. All filter functions return a boolean value, telling whether the filter was successfully applied. Each filter described has an image attached to let you tell the difference. So, let's dive into the filters!

Normal, unedited image
Normal, unedited image to compare against

iluAlienify
This filter originally occurred from an accident when I was writing colour matrix code but ended up looking really neat on some images, so I kept it. Images with people in them turn out the best with this filter, and no, it doesn't just change the image all green. ;-) It's a very interesting effect, imo, and I discovered it! =P

Alienified image

iluBitFilter1
This is a generally ugly filter that just switches the upper and lower nibbles of every byte in the image.

Bit-filtered image 1

iluBitFilter2
This is another ugly filter. It reverses the order of all bits in an image.

Bit-filtered image 2

iluBitfilter3
This filter AND's every byte with a random value from 0 - 255. This image is not included, since the effect is a type of noise filter, and noisy images do not compress well.

iluBlurAvg and iluBlurGaussian
iluBlurGaussian blur an image, using simple blurring convolution filters. A Gaussian blur looks more natural, as diagonal pixels count as the least, side pixels count in the middle and the center pixel counts the most. All values in the convolution matrix are 1, so all pixels around a pixel get averaged in as much as the pixel being tested. Both functions accept one parameter, which is the number of iterations of blurring to perform on the image. If you want to blur an image more, increase the number of iterations, but beware, as it will be slow. Only the Gaussian blur is shown here.

Blurred image

iluEdgeDetectP and iluEdgeDetectS
These two functions apply convolution filters to determine the edges in an image. A horizontal pass and a vertical pass on the image are combined to generate the appropriate edges. The algorithms are slightly different but generally give similar results. Experiment with them to see which one yields the best results for your application. Only the Prewitt edge-detected version is shown here.

Prewitt edge-detected image

iluEmboss
This function embosses an image, which makes it mostly grey with raised edges. This is a different form of edge detection.

Embossed image

iluGammaCorrectCurve
This function gamma corrects an image by applying a scaling factor to all the pixels of the image. Values for the scaling factor parameter above 1.0 brighten the image, while values below 1.0 darken the image.

Image with correction of 1.9 Image with correction of 0.5

iluNegative
iluNegative creates a negative of the image, effectively inverting all colours (black becomes white, etc.).

Negative image

iluNoise
iluNoise adds mono noise to an image to give it a noisy or even "dirty" look. The only parameter it accepts determines the variance factor -- how far from the original pixel's value the new value should be allowed to variate. This image is not included, since noisy images do not compress well.

iluPixelize
This function pixellizes an image, making it appear blocky. This function can be used for some neat effects, such as an interesting screen clearing effect.

Pixelized image with pixel size of 5

iluSharpen
iluSharpen "sharpens" the current image, making the edges more noticeable and the whole image "less blurry". Since the original has clearly-defined edges, the sharpen filter has no noticeable effect, so we decided not to include the image to save space.