ios - Unable to get Gif image frame count when get NSData of Gif Image fetched from iPhone -



ios - Unable to get Gif image frame count when get NSData of Gif Image fetched from iPhone -

unable gif image frame count when nsdata of gif image fetched iphone

i retriving gif image device , want convert nsdata, can retrive frames of gif.

right doing :

cgdataproviderref provider = cgimagegetdataprovider(largeimage.cgimage); nsdata* giforiginalimagedata = cfbridgingrelease(cgdataprovidercopydata(provider)); cgimagesourceref src = cgimagesourcecreatewithdataprovider(provider, null); size_t size = cgimagesourcegetcount(src); or cgimagesourceref src = cgimagesourcecreatewithdata((cfdataref)giforiginalimagedata, null); size_t size = cgimagesourcegetcount(src);

but here 'size' (gif frames count) coming 0 in every case. why?

while if load same gif image bundle

nsurl *url = [[nsbundle mainbundle] urlforresource:@"crad" withextension:@"gif"]; nsdata* giforiginalimagedata = [nsdata datawithcontentsofurl:url]; cgimagesourceref src = cgimagesourcecreatewithdata((cfdataref)giforiginalimagedata, null); size_t size = cgimagesourcegetcount(src);

it gives actual 'size' (gif frames count)

try this

alassetrepresentation *rep = [asset defaultrepresentation]; byte buffer = (byte)malloc(rep.size); nsuinteger buffered = [rep getbytes:buffer fromoffset:0.0 length:rep.size error:nil]; nsdata *data = [nsdata datawithbytesnocopy:buffer length:buffered freewhendone:yes];

fetch frames data

ios ios8 frame nsdata gif

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -