I use setImageData:metadata:completionBlock:
of ALAsset
to update the exif(metadata) of an asset.
I just want to update the metadata, but this method require an imageData
as the first parameter. I use the code below to generate imageData
, but it modified my image(I checked the file size and file hash).
ALAssetRepresentation *dr = asset.defaultRepresentation;
UIImage *image = [UIImage imageWithCGImage:dr.fullResolutionImage scale:dr.scale orientation:dr.orientation];
NSData *data = UIImageJPEGRepresentation(image, 1);
Is there any other method I could use to update just the exif of an ALAsset
? Or any way to generate the right imageData
for method setImageData:metadata:completionBlock:
?
I found a way to generate
imageData
. Code below:So I can use the data above with
setImageData:metadata:completionBlock:
to update only the exif ofALAsset
.