亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

問題設置圖像的exif數據

問題設置圖像的exif數據

炎炎設計 2019-08-06 15:11:41
問題設置圖像的exif數據我在iOS 4.1中使用新的ImageIO框架。我使用以下代碼成功檢索exif元數據:CFDictionaryRef metadataDict = CMGetAttachment(sampleBuffer, kCGImagePropertyExifDictionary , NULL);閱讀它,它似乎是有效的。保存圖像有效,但圖像中從不存在任何exif數據。    CGImageDestinationRef myImageDest = CGImageDestinationCreateWithURL((CFURLRef) docurl, kUTTypeJPEG, 1, NULL);     // Add the image to the destination using previously saved options.      CGImageDestinationAddImage(myImageDest, iref, NULL);     //add back exif     NSDictionary *props = [NSDictionary dictionaryWithObjectsAndKeys:                             [NSNumber numberWithFloat:.1], kCGImageDestinationLossyCompressionQuality,                            metadataDict, kCGImagePropertyExifDictionary, //the exif metadata                                                         nil];                           //kCGImagePropertyExifAuxDictionary     CGImageDestinationSetProperties(myImageDest, (CFDictionaryRef) props);     // Finalize the image destination.      bool status = CGImageDestinationFinalize(myImageDest);
查看完整描述

3 回答

?
滄海一幻覺

TA貢獻1824條經驗 獲得超5個贊

我嘗試了史蒂夫的答案并且它有效,但我認為它對于大型圖像來說很慢,因為它會復制整個圖像。


您可以使用CMSetAttachments直接在CMSampleBuffer上設置屬性。在打電話之前這樣做jpegStillImageNSDataRepresentation


CFDictionaryRef metaDict = CMCopyDictionaryOfAttachments(NULL, imageSampleBuffer, kCMAttachmentMode_ShouldPropagate);

CFMutableDictionaryRef mutable = CFDictionaryCreateMutableCopy(NULL, 0, metaDict);


NSMutableDictionary * mutableGPS = [self getGPSDictionaryForLocation:self.myLocation];

CFDictionarySetValue(mutable, kCGImagePropertyGPSDictionary, mutableGPS);


// set the dictionary back to the buffer

CMSetAttachments(imageSampleBuffer, mutable, kCMAttachmentMode_ShouldPropagate);

方法getGPSDictionaryForLocation:可以在這里找到:


在iOS4.1上保存帶照片的地理標記信息


查看完整回答
反對 回復 2019-08-06
  • 3 回答
  • 0 關注
  • 707 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號