cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Winnall <>
Subject generating GIFs on the fly
Date Tue, 29 Aug 2006 08:52:18 GMT
I am trying to generate GIFs on the fly with Cocoon. Obviously,  
generating PNGs is no problem, but unfortunately Internet Explorer  
can't handle PNGs because of a number of bugs which conflict with my  
site design. So I am stuck with having to generate GIFs for IE.

Is there a generally accepted way of doing this? I have a solution  
which works, but it is unsatisfactory for a number of reasons.

What I have done is to write a simple reader which reads things like  
cocoon:/**.png and converts them to GIFs. Thus I can generate PNGs on  
the fly and convert them to GIFs.

The problem lies in the conversion from PNG to GIF. My strategy is:

1) read PNG
2) convert to GIF
3) write GIF

No rocket science there. There are many ways of reading PNGs (and  
even GIFs), but not many ways of converting from PNG to GIF, and also  
few ways of writing GIFs. I use the SVG2PNG serialiser to create my  
PNGs, and by default this creates 24-bit images. GIF images are 8- 
bit. The process of reducing an image from X-bit to Y-bit (where X >  
Y) is called quantisation, as I have learned, and is a necessary step  
in the conversion process. I get the impression that you have to be a  
graphics expert to understand quantisation, and I am not.

I tried many different solutions to this problem:

1) Acme
2) JIU
3) ImageJ
4) ImageIO GIF Plugin

There are more GIF encoders available which will write GIFs, but I  
could only find the above packages with quantisers in them. I think  
JAI may have something in this area too, but I couldn't identify it  
to try it out.

So, I have had to revert to paid-for software. The solution that  
works for me - trivially - is GIF4J Light. The GIF encoder contains a  
quantiser which is called automatically if needed.If I had a  
fundamental interest in graphics, I might be able to make one of the  
others work, except perhaps the ImageIO GIF Plugin, which is still  
alpha. But for me the simple solution is GIF4J.

This is not intended as an ad for GIF4J. I would be interested to  
hear of alternative solutions that other people may have. I have  
nothing against non-open source software, but I was hoping to produce  
my website as 100% pure Java and 100% pure open source. The GIF thing  
has made this very difficult for me.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message