Java Image Filters
I have a large number of Java Image filters which are freely available for download from this site. The filters are all standard Java BufferedImageOps and can be plugged directly into existing programs. All the filters are available in the Java Image Editor and most have dialogs to allow you to play with their settings. If you want to try out any of these filters, I recommend downloading the editor and using the dialogs, which is generally much easier than writing code to try them.
Many of these filters are useful in applications such as games where images need to be generated on the fly, or where it's quicker to generate them rather than downloading them. For instance, it's quicker to download one image and rotate it several times than to download several separate images.
Another use for the filters is in animation. For example animating the Water Ripple filter can produce a nice rippling effect. Some of the filters have a time parameter for this purpose.
You can download the filters as a JAR file for your own use.
Philosophy and General Points
None of these filters are finely-tuned for speed, or even coarsely-tuned. Think of them as sample code for writing your own filters. I've preferred floating-point math over integer or fixed-point pretty well everywhere. By making the appropriate changes you'll probably be able to get these to go quite a bit faster.
All of the filters are designed to work with TYPE_INT_ARGB images. Some may work with other image types, but I make no guarantees.
All the filters are Java beans in the sense that they have default constructors and a set of properties. None of them have BeanInfo classes. This is for three reasons: firstly, the original versions predate the introduction of JavaBeans, and secondly, a BeanInfo class doesn't provide enough information to do a good UI for the properties, and thirdly, writing BeanInfo classes is really boring.
For the UI, we need all sorts of extra information that a BeanInfo doesn't provide: permitted ranges for values, usage (is this float a distance or an angle? what are its units?), grouping of properties and so on. Some of this could be overcome by providing more classes, e.g. having an Angle class, but this would just complicate usage and not provide any obvious benefit beyond a sort of warm object-oriented glow. To do this, I've provided an XML file with each filter which specifies the UI. The format of this file will probably change as the Image Editor UI evolves.
The filters don't support serialization. XMLEncoder does a much better job of handling this and I encourage you to use that instead.
Some of the filters have position parameters, e.g. for specifying the centre of the effect. These are generally expressed as a proportion of the width or height of the image in the range 0 to 1 rather than being measured in pixels. This allows the same filter settings to be applied to different size images.
Some filters, such as the transitions, take more than one source image. Where this happens, there are often two ways to call the filter. The first way is to call setXXX() methods on the filter for the extra images and then call the normal filter() method. The second way is to call a new filter() method which takes an array of images as its first parameter. The reasoning behind this is to allow the use of the filters anywhere a BufferedImageOp is allowed, but also to make it more convenient to use filters which require more than one source image.
The Filters
Color Adjustment Filters
ChannelMixFilter - Mixes the RGB channels
ContrastFilter - Adjusts brightness and contrast
CurvesFilter - Apply adjustment curves to an image
DiffusionFilter - Error-diffusion dithering
DitherFilter - Ordered dithering
ExposureFilter - Change the exposure of an image
GainFilter - Adjusts gain and bias
GammaFilter - Adjusts image gamma
GrayFilter - Grays out an image
GrayscaleFilter - Converts to grayscale
HSBAdjustFilter - Adjusts hue, saturation and brightness
InvertAlphaFilter - Inverts the alpha channel
InvertFilter - Inverts image colors
LevelsFilter - Adjust image levels
LookupFilter - Change image colors with a lookup table
MapColorsFilter - Replace a color
MaskFilter - Channel masking
PosterizeFilter - Posterization
QuantizeFilter - Quantize an image to 256 colors for, say, GIF export
RescaleFilter - Multiplies colors by a scaling factor
RGBAdjustFilter - Adjusts red, green and blue levels
SolarizeFilter - Solarization
ThresholdFilter - Thresholding
TritoneFilter - Create a tri-tone image
Distortion and Warping Filters
BicubicScaleFilter - Scaling with bicubic interpolation
CircleFilter - Wrap an image around a circle
CropFilter - Crop an area from an image
DiffuseFilter - Diffuse the pixels of an image
DisplaceFilter - A glass distortion effect
DissolveFilter - Dissolves an image by turning random pixels transparent
FieldWarpFilter - Warp images using a field warp algorithm
FlipFilter - Flip and rotate images
KaleidoscopeFilter - A kaleidoscope effect
MarbleFilter - A marbling effect
MirrorFilter - Mirror an image
OffsetFilter - Offset an image for tiling
PerspectiveFilter - Perspective distortion
PinchFilter - Whirl-and-pinch distortion
PolarFilter - Convert to and from polar coordinates
RippleFilter - Ripple distortion
RotateFilter - Rotate an image
ScaleFilter - Scale an image with area-averaging
ShearFilter - Shear an image
SphereFilter - Lens distortion
SwimFilter - An "underwater" distortion effect
TileImageFilter - Tile an image into a larger image
TwirlFilter - Distort an image by twisting
WarpFilter - A general grid image warp
WaterFilter - Simulate water ripples
Effects Filters
BlockFilter - Mosaic or pixellate an image
BorderFilter - Add a border
ChromeFilter - Simulate chrome
ColorHalftoneFilter - Color halftoning effect.
CrystallizeFilter - Make an image look like stained glass
EmbossFilter - Simple embossing
FeedbackFilter - A video feedback effect
HalftoneFilter - Simple halftoning
LightFilter - Simulate lights on an bump-mapped image
NoiseFilter - Add noise
PointillizeFilter - Draw an image as colored spots
ShadowFilter - Create drop shadows
ShapeFilter - Create bump maps for lighting
StampFilter - A rubber stamp effect
WeaveFilter - A woven image effect
Texturing Filters
BrushedMetalFilter - Created brushed metal
CausticsFilter - Simulate underwater caustics
CellularFilter - Cellular texturing
CheckFilter - Draw a checkerboard pattern
FBMFilter - Fractal Brownian motion texturing
FillFilter - Fill an image with a color
FlareFilter - Create lens flares
FourColorFilter - Draw a four-color gradient
GradientFilter - Draw radial, linear, fan and square gradients
PlasmaFilter - Create plasma
TextureFilter - Perlin noise texturing
ScratchFilter - Render lines or scratches
SmearFilter - Painting effects
SparkleFilter - Render sparkles
WoodFilter -Create a wood texture
Blurring and Sharpening Filters
BlurFilter - Simple blur
BoxBlurFilter - Box blur
BumpFilter - Edge embossing
ConvolveFilter - General convolution
DespeckleFilter - De-speckle an image
GaussianFilter - Gaussian blur
GlowFilter - Add a glow to an image
HighPassFilter - Remove low spatial frequencies
LensBlurFilter - Simulate camera lens blur
MaximumFilter - Dilation
MedianFilter - Median filter for noise reduction
MinimumFilter - Erosion
MotionBlurFilter - Simulate motion blur
OilFilter - Oil painting effect
RaysFilter - Create light rays
ReduceNoiseFilter - Remove noise from an image
SharpenFilter - Simple sharpening
SmartBlurFilter - A thresholded blur for ironing out wrinkles
UnsharpFilter - Sharpening by unsharp masking
VariableBlurFilter - Blurring with a variable radius taken from a mask
Edge Detection
DoGFilter - Edge detection by Difference of Gaussians
EdgeFilter - Edge detection
LaplaceFilter - Edge detection by Laplace operator
Transitions
BlurTransition - Transition with a blur
GradientWipeFilter - Use a mask to dissolve one image into another
Alpha Channel Filters
OpacityFilter - Change image opacity
PremultiplyFilter - Premultiply an image
UnpremultiplyFilter - Unpremultiply an image
Other Filters
CompoundFilter - Apply two filters in sequence
IteratedFilter - Iterate another filter