objective c - How to set GPano metadata of UIImages on iOS? -


i trying set metadata of uiimage spherical parameters. there multiple tutorials on web not set gpano fields.

here code using:

- (nsdata*)writemetadataintoimagedata:(nsdata*)imagedata metadata:(nsmutabledictionary*)metadataasmutable {    nsmutabledictionary *resultmutable = [metadataasmutable mutablecopy];   // create imagesourceref   cgimagesourceref source = cgimagesourcecreatewithdata((__bridge cfdataref) imagedata, null);    // read , log pre write metadata   nsdictionary* metadata = (nsdictionary *) cfbridgingrelease(cgimagesourcecopypropertiesatindex(source,0,null));   nslog(@"before:\n------------------------------%@\n------------------------------", metadata);    nsmutabledictionary* exifd = [resultmutable[(nsstring*)kcgimagepropertyexifdictionary] mutablecopy];   if (!exifd)   {     exifd = [nsmutabledictionary new];   }   exifd[@"aperturevalue"] = @3;   exifd[@"projectiontype"] = @"cylindrical";   exifd[@"xmp"] = @{@"gpano" : @{@"projectiontype": @"cylindrical"}};   exifd[@"gpano"] = @{@"projectiontype" : @"cylindrical"};    resultmutable = exifd;    // log new metadata want written   nslog(@"parameter:\n------------------------------%@\n------------------------------", resultmutable);    // type of image (e.g., public.jpeg)   cfstringref uti = cgimagesourcegettype(source);    // create new data object , write new image   nsmutabledata *dest_data = [nsmutabledata data];   cgimagedestinationref destination =     cgimagedestinationcreatewithdata((__bridge     cfmutabledataref)dest_data,uti,1,null);   if(!destination)   {     nslog(@"error: not create image destination");   }   // add image contained in image source destination, overidding old metadata our modified metadata   cgimagedestinationaddimagefromsource(destination,source,0, (__bridge cfdictionaryref) resultmutable);    bool success = no;   success = cgimagedestinationfinalize(destination);   if(!success)   {     nslog(@"error: not create data image destination");   }    // read , log post write metadata   cgimagesourceref  source2;   source2 = cgimagesourcecreatewithdata((__bridge cfdataref) dest_data, null);   nsdictionary *metadata2 = (nsdictionary *) cfbridgingrelease(cgimagesourcecopypropertiesatindex(source2,0,null));   nslog(@"after:\n------------------------------%@\n------------------------------", metadata2);    // cleanup   cfrelease(destination);    // return new data   return dest_data; } 

as can see directly using nsdata because uiimage stripping exif metadata. code works setting aperturevalue or orientation changes projectiontype ignored.

is setting gpano metadata projectiontype allowed on ios?


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -