aspose file tools*
The moose likes I/O and Streams and the fly likes Getting all image frames from animated .gif files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Getting all image frames from animated .gif files" Watch "Getting all image frames from animated .gif files" New topic
Author

Getting all image frames from animated .gif files

Gerald Lam
Greenhorn

Joined: Aug 23, 2010
Posts: 6
Hey, I've basically searched everywhere in trying to find out how to do this.
Can anyone point me in the right direction?
As in, I'm trying to extract all the files from an animated .gif files to .png file while keeping transparency.

EDIT : Nevermind, used C# instead.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

The ImageIO class could have helped you out:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Gerald Lam
Greenhorn

Joined: Aug 23, 2010
Posts: 6
Hm, I've already tried that, but it fits the image to screen.
So if an image is 32x32 but it has a 2px border of transparency,
it'll become 28x28
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Odd. I've tried that with a few images but all resulting images were equally large.
Gerald Lam
Greenhorn

Joined: Aug 23, 2010
Posts: 6
Weird, I tried it with this picture, but for this one, it doesn't resize tho, it just removes part of the picture.



Also, do you happen to know how to implement animated .gif files into slick?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Gerald Lam wrote:Weird, I tried it with this picture, but for this one, it doesn't resize tho, it just removes part of the picture.


It also happens to me with that image. My guess is that the GIF file was created with only the first image that large. I don't have any GIF editing software installed right now so I can't verify.

Also, do you happen to know how to implement animated .gif files into slick?

Not at all, sorry.
Gerald Lam
Greenhorn

Joined: Aug 23, 2010
Posts: 6
Hmm, I made that on photoshop and I'm sure every frame is the same size.
Extracting it with the C# extractor I had works fine, it's just that I'm having problems with this.
I need to do it on java so instead of using tons of images to animate it, I can just use a .gif file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting all image frames from animated .gif files