ios - Creating GIF from UIImages with CGImageDestinationRef results in broken line at bottom -


my code try creating gif images:

+ (nsdata *)creategifdatawithimages:(nsarray *)images duration:(cgfloat)duration withfilename:(nsstring *)filename {     cgfloat durationpadding = duration/((cgfloat)images.count);      nsstring *path = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject] stringbyappendingpathcomponent:filename];      cgimagedestinationref destination = cgimagedestinationcreatewithurl((cfurlref)[nsurl fileurlwithpath:path],                                                                         kuttypegif,                                                                         images.count,                                                                         null);      nsdictionary *frameproperties = [nsdictionary dictionarywithobject:[nsdictionary dictionarywithobject:@(durationpadding) forkey:(nsstring *)kcgimagepropertygifdelaytime]                                                                 forkey:(nsstring *)kcgimagepropertygifdictionary];     nsdictionary *gifproperties = [nsdictionary dictionarywithobject:[nsdictionary dictionarywithobject:[nsnumber numberwithint:0] forkey:(nsstring *)kcgimagepropertygifloopcount]                                                               forkey:(nsstring *)kcgimagepropertygifdictionary];      [images enumerateobjectsusingblock:^(id  _nonnull obj, nsuinteger idx, bool * _nonnull stop) {         uiimage *image = (uiimage *)obj;         cgimagedestinationaddimage(destination, image.cgimage, (cfdictionaryref)frameproperties);     }];      cgimagedestinationsetproperties(destination, (cfdictionaryref)gifproperties);     cgimagedestinationfinalize(destination);     cfrelease(destination);      nslog(@"animated gif file created @ %@", path);      return [nsdata datawithcontentsoffile:path]; } 

it did create gif @ last, image looks this:

enter image description here

aha,i fix bug

i thing images create or modification

uigraphicsbeginimagecontextwithoptions(size, opaque, scale);

just set opaque no ! enjoy yourself


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -