FilterFormula Main Page
1. Introduction
1.1 What is a plugin filter?
1.2 Notes for users of Filter Factory
The filters are defined in a simple algorithmic language which is more or less a subset of "C", compiled and stored in memory. If you have registered the full version (in contrary to the shareware version), you can also create fully functional standalone plugin filters that can be redistributed by you without any payments to the authors of FilterFormula.
In general, FilterFormula does the same tasks as the plugin called "Filter Factory" which is shipped as a part of Adobe Photoshop, but uses a different approach in filter definition. FilterFormula allows not only to define the filter algorithms as simple "C"-expressions, but also by flow control statements including 'if's, loop statements etc.. Besides that, it has some enhanced possibilities like gamma correction, HLS color system support and bilinear interpolation.
The main features of FilterFormula are:
From the point of view of a user (who doesn't care about the technical stuff) a filter is just a piece of software that uses a (usually photographic) image as input, processes it in a specially defined manner, and replaces this image with the results of the filtering process. It (usually) does not involve manual interaction (only parameters can be set) and operates according to a precisely defined algorithm.
A filter could do color enhancements, create mosaic-style effects or apply distortion effects.
Generally, you can distinguish between image enhancement filters (correct colors, correct lens irregularities etc.) and effect filters (creates effects that could not be easily done using a normal camera).
Both types of filters can be done with FilterFormula.
But you want to write your own filters. So - in contrary to the simple minded user - you will have to know a bit about the technical stuff about digital images and filters:
A digital image is stored in your computer's memory as a two-dimensional array (matrix) of so-called 'picture elements' or - short - pixels. Each pixel contains the color value (or, in case of black-and-white pictures, the lightness) at the corresponding part of the image. For color images, the color value generally consists of three values, one each for red, green and blue. Each channel can have values of 0 to 255 (that is eight bits = one byte). A value of zero means 'black', while a value of 255 always corresponds to the brightest possible color. This is the most common color system which is mainly used by most imaging programs.
Besides that, there are other color systems that can also be used by image editing programs, e.g. CMYK which is used in printing systems, where one color is described by the subtractive main colors cyan, magenta and yellow plus an additional black channel for dark images.
The HLS (or equivalent systems like HSL, HSB, ...) describes a color by three values, describing the hue (the angle in the color circle, which is 0 degrees for red, 120 for green and 240 for blue etc. - for a consistent scaling with all trigonometric functions the hue ranges from 0 to 1023 in FilterFormula), the lightness and the saturation (which is the color purity which reaches from 0 - grey image - to 256 - pure color).
There are also other color systems (e.g. the YUV system which is used by television systems) that are of minor importance for imaging software.
In Filter Formula, you can use the color systems RGB (which is the native one), HLS and YUV (can only be read) for read and write (in HLS and YUV, the values are converted from and to the RGB values).
In many imaging programs (those supporting the layer technique), besides the three bytes for red, green and blue, there is a fourth byte which describes the opacity of the respective layer (0 means completely transparent, 255 is opaque).
Currently, Filter Formula can only handle 24 bit per pixel (3x8 bits)
RGB color images (resp. RGBA including the alpha channel). If you want
to process an image which is defined in another color system (e.g. 8 bits
per pixel using a palette, 48 bit images, 8-bit black-and-white images
or CMYK pictures), you must first convert it to RGB (which can be done
in all image manipulation programs supporting Adobe-compatible filters.
The general use of FilterFormula is mainly the same as of Filter Factory, but there are some significant differences between both products. In the following you can find a short list of the major differences:
-->
The definition in Filter Factory is as follows (This can also be imported
into FilterFormula):
R: put(x%ctl(0),1),put(y%ctl(0),2),
put(c2m(get(1)-ctl(0)/2,get(2)-ctl(0)/2),3),put(get(3)<val(1,1,128)*ctl(0)/256,4),
put(x-x%ctl(0)+ctl(0)/2,10),put(y-y%ctl(0)+ctl(0)/2,11), get(4)?src(get(10),get(11),0):0
G: get(4)?src(get(10),get(11),1):0 B: get(4)?src(get(10),get(11),2):0 A: a; |
Simple to understand !?
The generic code for FilterFormula is:
dsize=ctl(0);
xrad=c2m(x%dsize-dsize/2,y%dsize-dsize/2); // difference from dot center if(xrad<=val(1,1,128)*dsize/256) // if (x/y) is within dot circle { centx=x-x%dsize+dsize/2; centy=y-y%dsize+dsize/2; R=src(centx,centy,0); G=src(centx,centy,1); B=src(centx,centy,2); } else R=G=B=0; A=a; |
Easier to understand, isn't it?
Previous Chapter |