combine multiple images to a gif

Discussion in 'iOS Programming' started by cinek, Jun 12, 2011.

  1. cinek macrumors 6502

    Mar 12, 2011
    how can I combine multiple jpg images to 1 gif in xcode? I can't find any info about this ;/
  2. North Bronson macrumors 6502

    Oct 31, 2007
    San José
    You can use Core Graphics to draw the different JPEGs into a new CGImage. You can use ImageIO to write the CGImage out to a GIF.
  3. cinek thread starter macrumors 6502

    Mar 12, 2011
    thanks, but how can I make it change/animate between the images? so that it shows 1 image for a few seconds, then the next image etc
  4. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    That's more like making a slideshow. not really showing just a gif.

    The gif ->

      // create the view that will execute our animation
        UIImageView* loadingScreen = [[UIImageView alloc] initWithFrame:self.window.frame];
        // load all the frames of our animation
        loadingScreen.animationImages = [NSArray arrayWithObjects:    
                                        [UIImage imageNamed:@"C64-1.png"],
                                        [UIImage imageNamed:@"C64-2.png"],nil];
        // all frames will execute in 1.75 seconds
        loadingScreen.animationDuration = 1.75;
        // repeat the annimation forever
        loadingScreen.animationRepeatCount = 3;
        // start animating
        [loadingScreen startAnimating];
        // add the animation view to the main window 
        [self.window addSubview:loadingScreen];
    About the slideshow thing, well that's a bit too much to just post.

Share This Page