File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Resizing a gif Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Resizing a gif" Watch "Resizing a gif" New topic

Resizing a gif

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
I have the following piece of code and it does not work with GIFs. It simply produces a 0ko image. It works fine with JPGs.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
ImageIO.write returns a boolean indicating success/failure. If you had checked it you would see false here. The J2SE ships with a GIF reader but not a GIF writer. That's because of copywrite issues some time ago, but the copywrite has since expired. There are several 3rd party gif writers out there: google for them. You can also download and install Sun's JAI Java(TM) Image I/O API which provides more reader/writer plug-ins for ImageIO. In the documentation for it:

It states:

An ImageWriter plug-in is provided for the Graphics Interchange Format (GIF). Animated GIF images may be created using the standard sequence writing methods defined in ImageWriter. By default the writer creates version "89a" images.

[ February 09, 2006: Message edited by: Jeff Albertson ]

There is no emoticon for what I am feeling!
I agree. Here's the link:
subject: Resizing a gif
It's not a secret anymore!