0
目前正在通過調整原稿以創建一個新的NSImage中,然後將其發送到Web服務,其原有的EXIF數據一起。我可以調整圖像大小,但EXIF數據不存在。到representationUsingType
調用發生在這是按照蘋果的文檔:)
可有人請點我在正確的dirrection請,這是我目前的執行正確的propertiesDict:
NSData *imageData = [resizedImage TIFFRepresentation]; //resized image is a my resized NSImage
NSBitmapImageRep * image = [[NSBitmapImageRep alloc] initWithData:imageData]; //NEED NSBitmapImageRepObject
NSMutableDictionary * propertiesDict = [[NSMutableDictionary alloc]init];
[propertiesDict setObject:[NSNumber numberWithInt:self.imageSizeSlider.floatValue] forKey:NSImageCompressionFactor];
[propertiesDict setObject:metaDataDict forKey:NSImageEXIFData];
NSData * shrunkImage = [image representationUsingType:NSJPEGFileType properties:propertiesDict];
如果我將writeToFile的shrunkImage對象我得到的圖像,但只有顏色配置文件在exif中? :( 的metaDataDict對象擁有所有的EXIF在我需要的,可以NSLogged證明。
任何幫助非常讚賞。 問候, 李
OK,我已經修改了我的問題,以表明我已經創建了一個較小版本的原點人。您對「您的新圖片只有您提供的元數據」的評論。是沒用的,如果你閱讀代碼並且對你的答案更實用,你會看到我提到我有原始的EXIF,並根據NSImage的文檔正確地將它應用於我的小NSImage。 – theiOSDude
框中解僱) –