FilterFormula Main Page
1. Introduction
1.1 What is a plugin filter?
1.2 Notes for users of Filter Factory
1. Introduction
Welcome to FilterFormula 1.0, an Adobe(TM)-compatible plug-in meta-filter
that allows you to create your own image filters for various image processing
software packages, such as
-
Adobe Photoshop (the most professional - and most expensive - of all)
-
JASC Paint Shop Pro (a very nice program that can do about 90% of the much
more expensive programs, especially useful if you do not need the support
for professional publishing/printing services)
-
Corel PhotoPaint 7 and 8
-
Microsoft PhotoDraw 2000
-
Ulead GifAnimator 3 (1)
-
Adobe Illustrator 7, Adobe AfterEffects 3 (1)
-
Fractal Design Painter 5 (1)
-
and many others...
((1) .. We wish to thank Harald
Heim who supplied us with this compatibility information)
The hardware and software requirements for FilterFormula are:
-
Personal Computer with Intel Pentium (or higher) compatible CPU
-
Microsoft Windows 95/98 or Windows NT 4 operating system (probably also
NT 5 will work!)
-
a minimum of 16 MB main memory (>64 MB preferred, as with all image editing
tasks)
-
2 MB of free hard disk space (for FilterFormula)
-
Imaging software that supports Adobe Photoshop compatible plugins (see
above)
-
An HTML internet browser (Netscape Navigator/Communicator or Microsoft
Internet Explorer)
Currently, FilterFormula is not available for Macintosh computers, there
are also no versions planned for the next future (but if the demand is
high enough, one never knows?! :-) ).
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:
-
highly sophisticated filter definition using simple "C" statements and
expressions, including loops (for smoothing etc.)
-
up to 256 (32 for shareware version) auxiliary variables can be used
-
generates native x386+ code, therefore very fast execution, up to 4 KB
machine code size (2 KB shareware version), very fast inline compilation
-
filter source up to 16384 bytes (16 KB), can be commented for better understandability
-
additional storage table in memory of user-definable size (max. 64 KB)
-
two-pass filtering architecture allows to define very complex filters (the
first pass can scan the image and do calculations, in the second pass the
image is actually changed), pre-filtering calculations in 'init'-block
and calculations between both filter passes in the 'init1'-block.
-
access to mask data (for feathered selections)
-
supports RGB, YUV (read-only) and HLS color mode (also mixed)
-
special support for Gamma correction tables
-
trigonometric functions
-
all calculations are done in 32 bit signed integers
-
compatible to Adobe Filter Factory plugins, import of Adobe filter source
files (*.afs); import and export of text files.
-
zoomable and pannable preview window
-
the full, registered version allows to create standalone plugin filters
that may be distributed or sold without any license fee (including on-line
help in HTML format)
-
handles also images that do not fit into main memory through banding technique
supported by Photoshop compatible programs.
-
smooth scaling by bilinear interpolation technique
-
no additional parts are required (no additional dll, compiler, linker etc.),
except from some standard Windows DLLs (installed on all Win95/98 &
NT systems).
-
comes with 17 professional filters in Source code that can be modified
to fit your requirements. Continuously the number grows bigger, also by
contributions of users!
-
On-line help in HTML format
If you are already familiar with Filter Factory and the concepts of plugin
filters, you might want to go directly to section 1.2
which explains the differences between Filter Factory and FilterFormula
in brief.
1.1 What is a plugin filter?
First, if you are not yet familiar with imaging sofware and plugins, let
me explain a bit the principles of a plugin filter.
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.
1.2 Notes for users of Filter Factory
This section is intended mainly for users that are familiar to the plugin
filter creation tool 'Filter Factory' which accompanies the image editing
software 'Photoshop' by Adobe.
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:
-
FilterFormula is available only for i386+ - PC platforms, while Filter
Factory is also available for other computer systems (e.g. Mac).
-
In Filter Factory, filters are defined as three (or four, for layers) "C"-style
expressions, while in FilterFormula they can be defined in free format
by "C" statements. They may contain loops, if-statements etc.
-
FilterFormula has many useful functions not contained in Filter Factory.
Those are:
-
Handling of the HLS color system
-
Image quality enhancements for scaling bitmaps by use of bilinear interpolation
(the xsrc() function)
-
Auxiliary variables can be defined
-
The size of the storage table can be defined in the program (not only 256
values, but up to 65536, user definable)
-
The range of each slider can be independently defined by the user.
-
access to the mask (selection) data via msk variable and src() function
-
6 color selector buttons and 2 custom checkboxes
-
several useful (mathematical) functions (pow(), gamma correction,
sorting), extended mathematical functions xmf()
-
Some variables and functions of Filter Factory do not exist in FilterFormula.
Those cannot be used any more as there are no different fields for the
four channels. Therefore the symbols using the current channel (c, z, cnv()
) cannot be used any more. If ".afs" files are imported into FilterFormula,
those are replaced by the corresponding symbols. "c" is replaced by "r",
"g", "b" or "a", while "z" is replaced with "0", "1", "2" or "3".
-
The variables x, y (current coordinates) and X, Y
(dimension of the image) are treated differently in FilterFormula than
in Filter Factory when applied on a selection (in Filter Factory x and
y range from 0 to X/Y which is the size of the selection and not the image
size; in FilterFormula the coordinates are the same as those if no selection
would be there). For compatibility reasons, the compiler
option !{fonlysel=1} has been implemented in FilterFormula.
Just to show an example, we can write a plugin that creates a "dotted"
effect on an image. The result of this operation can be seen in the following
two pictures (before and after filtering):
-->
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?
Back to Main Page