GIF Transcoders for ImageIO?

R

Rhino

Is anyone aware of any freeware transcoder plugins which would work in
ImageIO? I would like to convert GIFs to another format, such as JPG or PNG
but I'd rather not spend time re-inventing the wheel, especially if I can
find the wheel free somewhere :)
 
K

Knute Johnson

Rhino said:
Is anyone aware of any freeware transcoder plugins which would work in
ImageIO? I would like to convert GIFs to another format, such as JPG or PNG
but I'd rather not spend time re-inventing the wheel, especially if I can
find the wheel free somewhere :)

I believe that ImageIO will read GIF files but not write them.
 
R

Rhino

Knute Johnson said:
I believe that ImageIO will read GIF files but not write them.
Yes, I know that. That's why I'm looking for a transcoder; a transcoder will
take a GIF and rewrite it in a *different* format. For example, a GIF to PNG
transcoder will convert a GIF to a PNG file.

Rhino
 
A

Andrew Thompson

Rhino wrote:

(As we all know, Java does not *write* gif's..)
..That's why I'm looking for a transcoder; a transcoder will
take a GIF and rewrite it in a *different* format. For example, a GIF to PNG
transcoder will convert a GIF to a PNG file.

I think some of the sources on Marco Schmidt's site will
do the trick in core Java, you just need to specify PNG or
JPG for the output..
<http://schmidt.devlib.org/java/image-file-code-examples.html>

HTH
 
K

Knute Johnson

Rhino said:
Yes, I know that. That's why I'm looking for a transcoder; a transcoder will
take a GIF and rewrite it in a *different* format. For example, a GIF to PNG
transcoder will convert a GIF to a PNG file.

Rhino

Use ImageIO to read the GIF and use ImageIO to write it back out as a
PNG or JPG.

import java.awt.image.*;
import java.io.*;
import javax.imageio.*;

public class test3 {
public static void main(String[] args) throws Exception {
BufferedImage image = ImageIO.read(new File("button0.gif"));
ImageIO.write(image,"PNG",new File("button0.png"));
ImageIO.write(image,"JPG",new File("button0.jpg"));
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top