Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

Identifying Animated GIFs

Thread view: 
Rhino - 30 Sep 2005 17:24 GMT
How can I analyze a GIF file with Java code to determine whether it is a
single static GIF or an animated GIF?

Signature

Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare

Andrew Thompson - 30 Sep 2005 18:25 GMT
> How can I analyze a GIF file with Java code to determine whether it is a
> single static GIF or an animated GIF?

Marco Schmidt has a list of image libraries at the page here..
<http://schmidt.devlib.org/java/pixel-image-io-libraries.html>

I do not have much experience with them, beyond the
'FM Software - AnimatedGifEncoder' (which worked
just fine) but I notice they also offer a decoder..
Rationem - 30 Sep 2005 22:55 GMT
An animated gif file will have an extra header.

The GIF Header is 12 bytes plus the Color Table (which is num colors *
3)
12bytes + (255 * 3)bytes = 777bytes

After those bytes you can attempt to read one more byte
If it is the byte is....
0x2c         The image block has started. There is no animation
0x21 Read the next byte. If the next byte is....
0xff         Application Extension (++++ ANIMATED ++++)
0xf9        Graphics Control Block (++++ NOT animated ++++)

Regular GIF (87 + 89): (87 does not have graphics control ext)

[GIF Header]
[Graphics Control]
[Image Block]
[Trailer]

An animated GIF:

[GIF Header]
[Application Control]
[
         [Graphics Control]
         [Image Block]
]
Rhino - 02 Oct 2005 20:42 GMT
> How can I analyze a GIF file with Java code to determine whether it is a
> single static GIF or an animated GIF?

Thank you both for your suggestions!

Rhino


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.