|
Image filtersImage filters can be plugged in to enhance images during album generation, adding watermarking, logos etc. Image filters can be applied to closeup images, thumbnail images or both. Several filters can be chained to produce the desired effect. Imagine first applying red-eye reduction, then sharpening images and finally adding your logo to a corner. Well, all these filters are not written at the moment, but I expect them to show up: An open API and source code example are provided so developers easily can add new filters. Currently there is no graphical user interface for image filters, but with some fairly simple settings in the "User defined variables" section of the Advanced page, they can be controlled. Quick exampleLearning by example is powerful, so let's start by applying a grayscale filter to each thumbnail and add a copyright notice to the corner of each closeup image. (For a formal description of available filter features, see below.) Start JAlbum and prepare a project for album creation. Now go to the Advanced page of JAlbum. There you will find a section called "User defined variables". We will use this section to set the properties of our filters. Enter exactly as this example shows. Pay attention to capitalization, ("GrayscaleFilter" is different to Grayscalefilter"). When done, remember to press ENTER to store the new settings.
The filtersBelow is a list of the initially provided filters and their properties (features). New filters can be installed by putting their Java class files inside the plugins directory of JAlbum. All filters require the class property to be specified as filter identifier. All filters accept the thumbnails and closeups property that controls if the filter is to be applied to thumbnails only, closeups only or both. Default is both. Grayscale filter
Applies the grayscale filter to both thumbnails and closeups. Logotype filter
Add the JAlbum logo from the JAlbum web site to the right corner of closeups. Text filter
Add the file date of the image on top of the image in a light green color Shadow text filter
Extended properties (see TextFilter for the others):
Add the file date of the image on top of the image in a light green color with a black shadow Watermark filter
Extended properties (see TextFilter for the others):
Add a "JAlbum" watermark to the lower left edge Adding filters to skinsSkins can be configured to automatically use certain filter settings. Simply save a project containing suitable filter settings in the "User defined variables" section, then rename the project file to hints.jap and put it in the skin folder. JAlbum will now load filter settings from this file when such a skin is selected. Remember to also strip the hints file from other settings that you don't want to be applied. Developing filters
This section is for Java programmers who wish to extend JAlbum with new image filters.
JAlbum image filters are java classes added to the plugins directory that implement the small
se.datadosen.jalbum.JAFilter interface must provide getter methods for name and description pretty much like an Applet. The third method is the filter method that takes a BufferedImage and a java.util.Map as arguments and returns a modified BufferedImage . A filter is allowed to directly manipulate the passed BufferedImage . The Map object contains JAlbum $variables that may be useful for the filter implementer.
The preferred way to pass parameters to a filter is to implement setter methods for them. By using a smart BeanShell script in the init.hsh file in the JAlbum program directory, JAlbum is capable of passing attributes from the user defined variables section of the Advanced tab page to the corresponding setter method of a filter. The plugins JAlbum directory contains not only the filter classes but also the source code for the filters described on this page. Feel free to use them as base for your own filters. You will probably find the SimpleFilter below a good base for your own filters. The plugins folder also contains a compile.bat file that simplifies compilation for you. As you develop filters, please note that you do not need to restart JAlbum in order to refresh the filter classes as they are dynamically loaded every time an album is being processed. Finally, if you make a cool filter, please send it to me for inclusion. Sample filter source codeThe following simple filter adds a JAlbum logo to the corner of images:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
© 2003, Datadosen.se, David Ekholm |