coobird.net icon

projects.coobird.net

projects.coobird.net - Thumbnailator

Basic Design of Thumbnailator

Information provided in this section is from a previous version of Thumbnailator, and does not reflect the current version of the software. For current information, please visit the Thumbnailator project.

Thumbnailator consists of four main classes:

Thumbnailator is based around the TGenerator class which provides the thumbnail generation facilities. The thumbnails are generated according to the parameters set in the TImageParams object, which holds the source image location, thumbnail destination, and other settings that are needed to perform a thumbnail generation task.

The TRunner and THelper classes provide conveneince methods which simplify the process of using Thumbnailator. Applications that use Thumbnailator can use the two classes to to easily produce thumbnail images from existing images and optionally include a watermark with support for transparency.

Note: Thumbnailator uses the Java Image I/O API (javax.imageio package) to perform the image processing operations. The Java Image I/O API requires the Java(TM) 2 Platform, Standard Edition, Runtime Environment v. 1.4 or newer to run.

TGenerator class

The TGenerator class generates thumbnails by reading the source image and resizing it. (And adds an optional watermark with configurable transparency.)

When TGenerator receives the necessary information for the thumbnail generation task through the TImageParams object. The parameters such as the source image file location and the thumbnail destination location, along with file format information and thumbnail size is set through the TImageParams object and passed into the TGenerator instance.

To facilitate the use of TGenerator, there are convenience classes, TRunner and THelper, to simplify the process.

TImageParams class

The TImageParams class is a wrapper for thumbnail generation parameters. An instance of this class is used by the TGenerator class for performing thumbnail generation tasks.

Parameters such as the source image file and the destination thumbnail file information, along with the dimensions of the thumbnail and the watermark parameters are all included in the TImageParams object.

Applications which use Thumbnailator can instantiate and set the parameters of the thumbnail generation task through the TImageParams class, however, those tasks are simplified by using the TRunner and THelper classes which will generate TImageParams objects from simpler convenience methods.

TRunner class

The TRunner class is a container for TImageParams objects along with a generator for TImageParams objects from convenience methods provided by the class.

When processing multiple images for generating thumbnails, an instance of the TRunner class is created and the images to be processed are added through the instance methods provided.

THelper class

The THelper class is a helper class that provides convenience methods to generate thumbnails. Unlike the TRunner class, which is used by instantiating a TRunner object then adding adding images to process the object, the THelper class provides static methods, so the class itself is not instantiated to be used.

< Return to How to Use Thumbnailator

< Return to Thumbnailator project page