cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Pötz <>
Subject Re: [C3] Imaging Module
Date Thu, 15 Jan 2009 14:05:41 GMT
Steven Dolg wrote:
> Hi,
> I planned to come up with an Imaging Module for quite some time now.
> There were several situations in some of the projects I worked on where
> such a module would have been handy IMO.
> I also thought this might serve as another example of how the Pipeline
> API could be used.
> I did not invest much time (only a couple of hours this afternoon) and
> I'm actually not very versatile in using the Imaging API and/or Java2D.
> So please don't blame me when the implementation of the transformations
> is not ideal or not really fast.
> (Actually if someone know how to implement some or all of those
> manipulations better, I'd love to hear about that).
> The transformers still miss alot of configuration possiblities (most of
> it is simply hardwired) and are not really suited to be used in the
> Sitemap, yet.
> But I intend to continue working on this...
> So far I created the following transformers:
> * CropImageTransformer
>    Crops the image to an area of the configured size. The area is
> centered on the image
> * MaxSizeImageTransformer
>    Reduces the size of the image so that it fits inside the given
> dimensions. The aspect ratio of the image is maintained. If the image
> already fits inside the given bound it will remain unchanged.
> *RotateImageTransformer
>    Rotates the whole image by a given amount. Any value is possible.
> *ScaleImageTransformer
>    Scales the image by a given factor, maininting the aspect ratio.
> *WatermarkImageTransformer
>    Write a configurable text centered on the image. Color and
> transparancy of the text is configurable.
> Additionally there is an ImageGenerator and an ImageSerializer.
> Both ImageGenerator and ImageSerializer use the Imaging API of Java. So
> by default the image formats JPG, PNG, GIF and BMP are supported (IIRC).
> Additional formats may be supported by registering them with the Imaging
> API.
> All the components mentioned above a fully compatible to each other -
> and not compatible to any other Cocoon 3 components currently available
> - and the transformers can be combined in every way.
> The basic rules of the PipelineAPI still apply of course (Generator ->
> Transformer* -> Serializer)
> I have provided a unit test that uses several pipelines using all
> components.
> Attached you can find the patch for the code and a sample image (in case
> you have none handy).
> The generator uses the URL mechanism already implemented in other
> generators in Cocoon 3, so images can also be loaded directly from a web
> site or some other location.

Since I had the chance to look over Steven's shoulder when he
implemented these components yesterday, I have to say that it is *really
cool stuff*. Thanks Steven!

It also demonstrates the power of pipelines and the usage of the
interfaces (starter, finisher, consumer, producer) very well. Everybody
who wants to get familiar with the basics of C3, should take a closer look.

I'm +1 to add the patch to the C3 code base.

Reinhard Pötz                           Managing Director, {Indoqa} GmbH

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member        

View raw message