PLEASE RELOAD
GD Library Filters



Filter List
This is a basic filter list; used for jpegs ONLY. The numbers at the end are the values for the filter. More about that will be discussed later.

  • imagefilter($im, IMG_FILTER_SHARPEN);
  • imagefilter($im, IMG_FILTER_SMOOTH, 80);
  • imagefilter($im, IMG_FILTER_SELECTIVE_BLUR);
  • imagefilter($im, IMG_FILTER_NEGATE);
  • imagefilter($im, IMG_FILTER_MEAN_REMOVAL);
  • imagefilter($im, IMG_FILTER_GAUSSIAN_BLUR);
  • imagefilter($im, IMG_FILTER_BRIGHTNESS, 150);
  • imagefilter($im, IMG_FILTER_EDGEDETECT);
  • imagefilter($im, IMG_FILTER_EMBOSS);
  • imagefilter($im, IMG_FILTER_CONTRAST, 30);
  • imagefilter($im, IMG_FILTER_GRAYSCALE);



True to the intuitiveness of this program they do just what they say. No mystery there except perhaps mean removal which really is mean, roughs up your image....Brightness at 100 is what you have to start with, and as with all of them the higher the value the more the filter does. Emboss and Edge Detect will turn your entire canvas grey. Just imagefill the background to your color choice and continue the script. If you want the background to be transparent, put that function at the end just before the output.

Here are some examples of filters that show the most change with one application. Click on thumb to see full size.


Original

Edge

Emboss

Gaussian

Mean

Negate

Select



Filter Use
The filter functions are used exactly how they are written above and used anywhere in the script. You can use as many as want back to back, or just one and they can be the same or different filters. For example:

imagettftext($im, 50, 0, 29, 79, $grey, $font, $text);
imagettftext($im, 50, 0, 31, 81, $grey, $font, $text);
imagettftext($im, 50, 0, 30, 80, $black, $font, $text);
imagefilter($im, IMG_FILTER_EDGEDETECT); imagefilter($im, IMG_FILTER_EMBOSS);
imagefill($im, 10, 10, $white);
imagettftext($im, 50, 0, 29, 79, $grey, $font, $text);
imagettftext($im, 50, 0, 31, 81, $grey, $font, $text);
imagettftext($im, 50, 0, 30, 80, $maroon, $font, $text);
imagefilter($im, IMG_FILTER_SHARPEN);
imagefilter($im, IMG_FILTER_SHARPEN);

Edge detect, emboss, blur and sharpen are your main filters but all of them can produce wonderful effects. Puffy text relies on emboss and edge detect...both are used in this example.

Sally


Sticking to black, white and grey; metallic text is possible. There is no exact way to use the filters...it's all up to you. What they do depends on what you do. They react differently in different scripts depending on colors used, order and transparency, if any, of colors, textures and everything in between.

This zip file contains the original Tag php script and txt and the original Text php script and text, plus the font and background to produce what you see on this page. Let your imagination go and have some fun...!!!

http://simplysally.com/GD/lessons/filters.zip


GD BasicsHome