Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resizing a gif

 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic