简体   繁体   English

如何从现有图像(从相机)创建支持PropertyItems的C#位图

[英]How to create C# Bitmap supporting PropertyItems from existing Image (from Camera)

I am creating an C# Image from a camera. 我正在从相机创建C#图像。 I want to create an image that supports PropertyItems from this image so that I can include audit-level details in the meta-data. 我想从该图像创建一个支持PropertyItems的图像,以便可以在元数据中包括审核级别的详细信息。

The Image created by the camera does not support PropertyItems, and so I want to create one that does from the existing image. 相机创建的图像不支持PropertyItems,因此我想从现有图像创建一个。 Ideally it should be lossless, and fast. 理想情况下,它应该是无损且快速的。

Examples I have seen that create images that support these meta-data attributes are generated by reading the image from a file, and not from an in-memory already-existing image. 我看到的示例创建支持这些元数据属性的图像是通过从文件而不是从内存中已经存在的图像读取图像来生成的。

Any recommendations for this? 有什么建议吗?

Note that I am avoiding using a containing class, or derived Image class for reasons of minimal integration issues. 请注意,出于最小化集成问题的原因,我避免使用包含类或派生的Image类。

I'm assuming by "creating an C# Image from a camera" you mean "loading a JPEG image created by a camera into a C# Image object"? 我假设“从相机创建C#图像”是指“将相机创建的JPEG图像加载到C#图像对象中”吗?

The PropertyItems Property of an Image object allows you to do this, regardless of whether your Camera populates such data itself or not. Image对象的PropertyItems属性允许您执行此操作,而不管您的相机本身是否填充此类数据。 If you open the (JPEG) image, set properties and save back. 如果打开(JPEG)图像,请设置属性并保存回来。 If you don't edit the image bitmap itself, I believe it will be saved in the same (compressed) format. 如果您不编辑图像位图本身,我相信它将以相同(压缩)格式保存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM