objective-c - 添加Exif信息为什么会增加照片Data大小?
给我你的怀抱
给我你的怀抱 2017-05-02 09:37:44
0
0
701
NSData *imageData = UIImageJPEGRepresentation(image, 0.4);
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge     CFDataRef)imageData, NULL);
NSMutableDictionary *metaDataDic = [self getEXIF:imageData];
NSMutableDictionary *exifDic = [[metaDataDic objectForKey:(NSString*)kCGImagePropertyExifDictionary] mutableCopy];
NSMutableDictionary *GPSDictionary = [[metaDataDic objectForKey:(NSString*)kCGImagePropertyGPSDictionary] mutableCopy];

if(!exifDic) { exifDic = [NSMutableDictionary dictionary]; }
if(!GPSDictionary) { GPSDictionary = [NSMutableDictionary dictionary]; }

NSTimeZone    *timeZone   = [NSTimeZone timeZoneForSecondsFromGMT:8*3600];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setTimeZone:timeZone];
[formatter setDateFormat:@"YYYY:MM:dd hh:mm:ss"];
NSString *now = [formatter stringFromDate:[NSDate date]];
[exifDic setObject:now forKey:(NSString *)kCGImagePropertyExifDateTimeOriginal];

[metaDataDic setObject:exifDic forKey:(NSString*)kCGImagePropertyExifDictionary];

CFStringRef UTI = CGImageSourceGetType(source);
NSMutableData *newImageData = [NSMutableData data];
CGImageDestinationRef destination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)newImageData, UTI, 1, NULL);

CGImageDestinationAddImageFromSource(destination, source, 0, (__bridge CFDictionaryRef)metaDataDic);
CGImageDestinationFinalize(destination);

如果imageData初始值为69091bytes,添加Exif信息后会变成114691bytes,我并不想添加Exif信息后增加这么大的数据size,请问这是什么原因?

给我你的怀抱
给我你的怀抱

모든 응답(0)
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!