正如@Codo 所指出的,在输出图像(到显示器、打印机、RIP 或其他任何东西)之前,像素密度是无关紧要的。它是元数据,而不是图像数据。但是,如果您正在处理没有智慧理解这一点的第三方服务,则需要在捕获图像之后和保存之前编辑图像元数据。
这是如何:
captureStillImageAsynchronouslyFromConnection:stillImageConnection
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer
NSError *error) {
CFDictionaryRef metadataDict = CMCopyDictionaryOfAttachments(kCFAllocatorDefault,
imageDataSampleBuffer,
kCMAttachmentMode_ShouldPropagate);
NSMutableDictionary *metadata = [[NSMutableDictionary alloc]
initWithDictionary:(__bridge NSDictionary*)metadataDict];
CFRelease(metadataDict);
NSMutableDictionary *tiffMetadata = [[NSMutableDictionary alloc] init];
[tiffMetadata setObject:[NSNumber numberWithInt:300]
forKey(NSString*)kCGImagePropertyTIFFXResolution];
[tiffMetadata setObject:[NSNumber numberWithInt:300] forKey:
(NSString*)kCGImagePropertyTIFFYResolution];
[metadata setObject:tiffMetadata forKey:(NSString*)kCGImagePropertyTIFFDictionary];
.
.
.
}];
然后根据您的要求metadata
输入或保存到您writeImageToSavedPhotosAlbum:metadata:completionBlock
的私人应用程序文件夹中。writeImageDataToSavedPhotosAlbum:metadata:completionBlock