Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-01-2008, 08:27 PM   #1 (permalink)
Gold Orange
 
orange gold's Avatar
 
Join Date: Sep 2008
Posts: 679
Default animated gifs only show first frame?

i used the basic ui image code to load my animated gif... but when i clicked build and go and loaded the aplication it only showed the first frame of my gif and no animation??? help me???
orange gold is offline   Reply With Quote
Old 10-02-2008, 12:57 PM   #2 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 8
Default

Don't anim gifs have a flag (set at export from the creation application) to dictate playback parameters? Been a while since I created one, but this seems to ring a bell...
scoop is offline   Reply With Quote
Old 10-02-2008, 06:41 PM   #3 (permalink)
Gold Orange
 
orange gold's Avatar
 
Join Date: Sep 2008
Posts: 679
Default

i have no clue what a flag is. please help
orange gold is offline   Reply With Quote
Old 10-02-2008, 10:23 PM   #4 (permalink)
Gold Orange
 
orange gold's Avatar
 
Join Date: Sep 2008
Posts: 679
Default

sry for bump but this is urgent
orange gold is offline   Reply With Quote
Old 10-03-2008, 07:04 AM   #5 (permalink)
Registered Member
 
Jume's Avatar
 
Join Date: Jul 2008
Location: Slovenia, EU
Posts: 264
Send a message via Skype™ to Jume
Default

Quote:
Originally Posted by orange gold View Post
sry for bump but this is urgent
I dont know how SDK treats animated GIFs but you could easily set up a sequence of separate pictures into UIImageVIew and then run startAnimating to play the animation of that image sequence. Just export every frame of your gif to separate image and then use animationImages array property of UIImage view to add UIImages

Code:
 myImageView.animationImages
and

Code:
 [myImageView startAnimating]
[myImageView stopAnimating]
for controlling playback.
Jume is offline   Reply With Quote
Old 10-03-2008, 07:22 AM   #6 (permalink)
New Member
 
Join Date: Oct 2008
Posts: 8
Default

Quote:
Originally Posted by orange gold View Post
i have no clue what a flag is. please help
A flag is a switch, i.e. an option you can set in the file dialog when you save your gif.

For example, "Looping? [Yes/No]"

If no options are present then the problem may lie elsewhere. Have you tried loading it into another animgif supporting application and re-saving?

The guy in this thread had problems with animgif (Safari, if that has any relevence) - he solved it simply by creating a fresh page, so the reason it wasn't working was never uncovered. Simply an iPhone idiosyncracity or bug, perhaps.

problem with animated gif
scoop is offline   Reply With Quote
Old 04-28-2009, 03:11 AM   #7 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 16
Smile

Animated GIF's only display the first frame in a UIImage. To get all of the frames, the GIF image needs to be decoded first.

Crude example code can be found here:
iPhone developer: decoding an animated GIF image in Obj-C - Pliep.nl
Wizfinger is offline   Reply With Quote
Old 07-05-2009, 11:56 AM   #8 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 1
Default

Quote:
Originally Posted by Wizfinger View Post
Animated GIF's only display the first frame in a UIImage. To get all of the frames, the GIF image needs to be decoded first.

Crude example code can be found here:
iPhone developer: decoding an animated GIF image in Obj-C - Pliep.nl
I fixed all this, and put it in a simple class. My class also support transparency . It's free to use commercially, as long as you leave an attribution in the code to me.

Take a look here
StijnSpijker is offline   Reply With Quote
Old 07-07-2009, 04:44 AM   #9 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 16
Default

I tried your class and it is nicely done. I found that compressed GIF frames do not work because any compressed frame needs to be combined with the previous frame to get a full image.

Unfortunately I've not been able to figure out how to implement it.

Example image:
http://www.p-edge.nl/downloads/gen4.gif

Some frames of the image are fully stored (such as the first frame), but other frames are compressed and only contain changes that have to be applied to the frame before it.

For example, the second frame is compressed and needs to be masked upon the first frame to create a complete second frame image.

This can be done by using CGImageCreateWithMaskingColors. Code here:
http://www.p-edge.nl/downloads/maskimageframe.m

The first frame can be saved immediately, and consecutive frames can be applied by using - maskFrame: withFrame:

However.... animated GIF images may also contain several frames that are "stand-alone", and those do NOT have to be masked upon their predecessor.

I've not been able to find out how in de GIF specifications how to detect if a frame can be displayed "as is" or of it needs to be applied to the previous frame.

If you can be of any assistance, please build it into your class

thanks!
Wizfinger is offline   Reply With Quote
Old 07-19-2009, 09:12 PM   #10 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 15
Smile

Quote:
Originally Posted by StijnSpijker View Post
I fixed all this, and put it in a simple class. My class also support transparency . It's free to use commercially, as long as you leave an attribution in the code to me.

Take a look here
when i do this there are transparent spots on my gif animation is there any way to fix this? thanks
GeoffMilburn is offline   Reply With Quote
Old 07-20-2009, 09:29 AM   #11 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,544
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

Seems like it would be easier to manually split the gif into frames, using some 3rd party program. I'm sure you can find some free programs that do this, just google for it. Then take the resulting image frames, and use them in a UIImageView or what-have-you.
smithdale87 is offline   Reply With Quote
Old 07-21-2009, 06:14 AM   #12 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 16
Default

correct, but that does not work if the GIF images needs to be constantly updated, like when taken from the web.
Wizfinger is offline   Reply With Quote
Old 07-21-2009, 10:44 AM   #13 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,544
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

If it's being loaded from the web,

#1. If it's 3rd party and you dont have access, it's not a good idea anyways, because if that image ever gets removed, then your app is useless.

#2. If it's not 3rd party, then you would have access. So instead of using it as a gif, provide yourself with the still frames and then just animate it on the iPhone.
smithdale87 is offline   Reply With Quote
Old 07-21-2009, 11:05 AM   #14 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 16
Default

#3. it could be 3rd party by use of an API or other standards you are following without any risk of removal

#4, it could be 1st party (eg on your own website) like for instance a news site where content and images need to be downloaded regularly and the images can not be stored in the app bundle beforehand.
Wizfinger is offline   Reply With Quote
Old 07-22-2009, 03:37 PM   #15 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 15
Default

Quote:
Originally Posted by smithdale87 View Post
Seems like it would be easier to manually split the gif into frames, using some 3rd party program. I'm sure you can find some free programs that do this, just google for it. Then take the resulting image frames, and use them in a UIImageView or what-have-you.
Thanks for the suggetion I took it apart and put it back together works great now
GeoffMilburn is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 158,294
Threads: 89,032
Posts: 379,807
Top Poster: BrianSlick (7,086)
Welcome to our newest member, Marian123
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:43 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0