GIF animate too fast on Computer - iOS -


i trying create gif animated images, pass array of images.

lets have 4 seconds video , extract 120 frames it. regardless of created gif size, create gif 120 frames. problem is, when open gif in iphone (by attaching mailviewcomposer or imessage) runs fine, if email it, or import computer, runs fast. can suggest wrong here?

i using hjimagestogif gif creation. dictionary gif properties below:

nsdictionary *prep = [nsdictionary dictionarywithobject:[nsdictionary dictionarywithobject:[nsnumber numberwithfloat:0.03f]                                                                                     forkey:(nsstring *) kcgimagepropertygifdelaytime]                                                  forkey:(nsstring *) kcgimagepropertygifdictionary];  nsdictionary *fileproperties = @{                                  (__bridge id)kcgimagepropertygifdictionary: @{                                          (__bridge id)kcgimagepropertygifloopcount: @0, // 0 means loop forever                                          }                                  }; 

creation of gif:

cfurlref url = (__bridge cfurlref)[nsurl fileurlwithpath:path];  cgimagedestinationref dst = cgimagedestinationcreatewithurl(url, kuttypegif, [images count], nil); cgimagedestinationsetproperties(dst, (__bridge cfdictionaryref)fileproperties);  (int i=0;i<[images count];i++) {     //load animage array     uiimage * animage = [images objectatindex:i];      cgimagedestinationaddimage(dst, animage.cgimage,(__bridge cfdictionaryref)(prep));  }  bool filesave = cgimagedestinationfinalize(dst); cfrelease(dst); if(filesave) {     nslog(@"animated gif file created @ %@", path); }else{     nslog(@"error: no animated gif file created @ %@", path); } 

to save gif, i’m using:

alassetslibrary *library = [[alassetslibrary alloc] init];  nsdata *data = [nsdata datawithcontentsofurl:[nsurl urlwithstring:temppath]]; data = [nsdata datawithcontentsoffile:temppath];  [library writeimagedatatosavedphotosalbum:data metadata:nil completionblock:^(nsurl *asseturl, nserror *error) {     if (error) {         nslog(@"error saving gif photo album: %@", error);     } else {         // todo: success handling         nslog(@"gif saved %@", asseturl);     } }]; 

thanks everyone.


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -