你能在iOS上保存一个编辑好的RAW .dng文件吗? [英] Can you save an edited RAW .dng file on iOS?
问题描述
我想构建一个iOS 10应用程序,让您拍摄RAW( .dng
)图像,编辑它,然后保存已编辑的 .dng
文件到相机胶卷。通过结合Apple 2016的 AVCamManual 和 RawExpose 示例应用程序中的代码,我已经达到了 CIFilter
包含RAW图像以及编辑。
I want to build an iOS 10 app that lets you shoot a RAW (.dng
) image, edit it, and then saved the edited .dng
file to the camera roll. By combining code from Apple's 2016 "AVCamManual" and "RawExpose" sample apps, I've gotten to the point where I have a CIFilter
containing the RAW image along with the edits.
但是,我无法弄清楚如何保存生成的 CIImage
作为 .dng
文件进入相机胶卷。这可能吗?
However, I can't figure out how to save the resulting CIImage
to the camera roll as a .dng
file. Is this possible?
推荐答案
RAW文件是直接来自相机传感器的原始输出,所以获得它的唯一方法直接来自相机。一旦你处理了一个RAW文件,你所拥有的就不再是原始了,所以你不能回到RAW。
A RAW file is "raw" output direct from a camera sensor, so the only way to get it is directly from a camera. Once you've processed a RAW file, what you have is by definition no longer "raw", so you can't go back to RAW.
扩展比喻在WWDC上展示了他们推出了RAW摄影 ...... RAW文件就像蛋糕的成分。当您使用Core Image从RAW文件创建可视图像时,您正在烘焙蛋糕。 (并且如上所述,有许多不同的方法可以用相同的成分烘焙蛋糕,对应于处理RAW的可能选项。)但是你不能烘烤蛋糕 - 没有回到原始成分,更不用说一种以某种方式保留处理结果的方式。
To extend the metaphor presented at WWDC where they introduced RAW photography... a RAW file is like the ingredients for a cake. When you use Core Image to create a viewable image from the RAW file, you're baking the cake. (And as noted, there are many different ways to bake a cake from the same ingredients, corresponding to the possible options for processing RAW.) But you can't un-bake a cake — there's no going back to original ingredients, much less a way that somehow preserves the result of your processing.
因此,存储从RAW原件处理的图像的唯一方法是将处理后的图像保存在位图图像中格式。 (如果您不介意有损压缩,请使用JPEG,如果您需要无损等,请使用PNG或TIFF。)
Thus, the only way to store an image processed from a RAW original is to save the processed image in a bitmap image format. (Use JPEG if you don't mind lossy compression, PNG or TIFF if you need lossless, etc.)
如果您要将编辑结果写入< a href =https://developer.apple.com/videos/play/wwdc2016-501/?time=1749\"rel =nofollow> PHPhotoLibrary
,使用JPEG(如果您愿意,可以使用高质量/较少压缩),照片会将您的编辑存储为派生结果,允许用户恢复为RAW原件。您还可以使用编辑保存在 PHAdjustmentData
中应用的过滤器集 - 使用调整数据,应用的另一个实例(或照片应用扩展程序)可以使用以下内容重新构建编辑原始RAW数据加上您保存的过滤器设置,然后允许用户更改过滤器参数以创建不同的已处理图像。
If you're writing the results of an edit to PHPhotoLibrary
, use JPEG (high quality / less compressed if you prefer), and Photos will store your edit as a derived result, allowing the user to revert to the RAW original. You can also describe the set of filters you applied in PHAdjustmentData
saved with your edit — with adjustment data, another instance of your app (or Photos app extension) can reconstruct the edit using the original RAW data plus the filter settings you save, then allow a user to alter the filter parameters to create a different processed image.
注意:有一种名为线性DNG的DNG格式版本支持非RAW(或不完全RAW)图像,但在实践中相当罕见,Apple的成像堆栈不支持它。
Note: There is a version of the DNG format called Linear DNG that supports non-RAW (or "not quite RAW") images, but it's rather rare in practice, and Apple's imaging stack doesn't support it.
这篇关于你能在iOS上保存一个编辑好的RAW .dng文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!