This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting all image frames from animated .gif files

 
Gerald Lam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ImageIO class could have helped you out:
 
Gerald Lam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Odd. I've tried that with a few images but all resulting images were equally large.
 
Gerald Lam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic