Two Laptop Bag*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Resizing a gif" Watch "Resizing a gif" New topic
Author

Resizing a gif

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,
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:

http://java.sun.com/products/java-media/jai/forDevelopers/jai-imageio-1_0_01-fcs-docs/index.html

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!
 
 
subject: Resizing a gif