You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stephen Winnall <st...@winnall.ch> on 2006/08/29 10:52:18 UTC
generating GIFs on the fly
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.
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: generating GIFs on the fly
Posted by Stephen Winnall <st...@winnall.ch>.
I should have added in my original posting that the images use
transparency, which I don't think JPEG can handle. And with JPEG I
would still have the quantisation problem, which for me was the most
intractable aspect. Preserving transparency in the conversion from
PNG to GIF is an added difficulty.
Steve
On 29 Aug 2006, at 11:31, Bertrand Delacretaz wrote:
> On 8/29/06, Stephen Winnall <st...@winnall.ch> wrote:
>> 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....
>
> Note that the Batik block can generate JPEG as well as PNG, from SVG.
>
> But IIUC you have your own PNG-generating stuff so it might not apply.
>
> -Bertrand
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: generating GIFs on the fly
Posted by Bertrand Delacretaz <bd...@apache.org>.
On 8/29/06, Stephen Winnall <st...@winnall.ch> wrote:
> 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....
Note that the Batik block can generate JPEG as well as PNG, from SVG.
But IIUC you have your own PNG-generating stuff so it might not apply.
-Bertrand
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: generating GIFs on the fly
Posted by Stephen Winnall <st...@winnall.ch>.
Thanks for the suggestion. I looked at JMagick, but it seems to be
fairly rudimentary (can't apparently read InputStreams or write
OutputStreams). In addition, my Image Magick implementation is
displaying strange behaviour with PNGs.
I think I'll have to stick with the GIF4J solution because I can't
afford to spend any more time on this problem.
Steve
On 29 Aug 2006, at 12:49, Jorg Heymans wrote:
>
>> 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.
>
> <snip>
>
>> I tried many different solutions to this problem:
>>
>> 1) Acme
>> 2) JIU
>> 3) ImageJ
>> 4) ImageIO GIF Plugin
>
> Have you tried ImageMagick? I found their encoders to be quite
> good. At
> the time i was using it (3 years ago) the java port - JMagick -
> wasn't all
> that stable, but perhaps this has been improved.
>
> HTH
> Jorg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: generating GIFs on the fly
Posted by Jorg Heymans <jh...@domek.be>.
> 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.
<snip>
> I tried many different solutions to this problem:
>
> 1) Acme
> 2) JIU
> 3) ImageJ
> 4) ImageIO GIF Plugin
Have you tried ImageMagick? I found their encoders to be quite good. At
the time i was using it (3 years ago) the java port - JMagick - wasn't all
that stable, but perhaps this has been improved.
HTH
Jorg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org