nicklockwood/JPNG

functionality query

mrose17 opened this issue · 3 comments

nick - first thanks for many useful libraries (iCarousel, FXImage, et. al.)... i hope to be launching an app in about six weeks with them, and i'll drop you a note.

here is a query for you, since you seem to be the "iOS image guy" (-;

i would like to have an imageview that does the equivalent of an animated GIF. i am debating whether to implement an APNG decoder -- http://en.wikipedia.org/wiki/Animated_PNG -- and do some fancy (but probably still slow) timing stuff, or look for another approach.

have you given any thought to this area? i'm not asking you to write any code, just wondering how one might proceed...

thanks!

/mtr

UIImageView already supports animation, so you can simply supply an array of UIImage objects and it will play them automatically.

As of iOS5, I believe UIImage can be initialised with multiple images and will then loop through them automatically.

If you want to bundle all of those images into a single file, the APNG specification looks good, but it's considerably more complex than JPNG, so unless you want to spend several days implementing it, I'd suggest just sticking with a folder of individual image frames.

You might also want to take a look at my GLView library, which provides a GLImage / GLImageView that can load a cocos-2D style spritesheet. That would allow you to bundle all your image frames into one file and then play them as a sequence. The advantage of that is that you can create the sprite sheet using an existing 3rd party tool such as Zwoptex or TexturePacker.

nick - thanks very much for the helpful (and speedy) reply! i'll have to do some research on the sprite sheet approach, but either way, this looks like the path to take.

best,

/mtr