检测图像颜色空间是CMYK还是PMS [英] Detect if image color space is CMYK or PMS

查看:306
本文介绍了检测图像颜色空间是CMYK还是PMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为这家印刷公司创建一个小型图片上传验证器,他们需要确保上传的图片的颜色空间为CMYK或PMS。

I'm creating a small image upload validator for this printing company, they need to make sure that an uploaded image has a color space of either CMYK or PMS.

这就是我现在正在使用的:

This is what I'm using right now:

Image img = Image.FromStream(fupFile.PostedFile.InputStream);
ImageFlags flags = (ImageFlags)Enum.Parse(typeof(ImageFlags), img.Flags.ToString());

然后我可以检查标志,其中包含类似部分可扩展的内容| ColorSpaceCmyk | HasRealPixelSize。这里有更多信息: http:// msdn。 microsoft.com/en-us/library/system.drawing.imaging.imageflags.aspx

I can then check flags, which will contain something like "Partially Scalable | ColorSpaceCmyk | HasRealPixelSize". There's more info on it here: http://msdn.microsoft.com/en-us/library/system.drawing.imaging.imageflags.aspx

请注意,PMS色彩空间没有标志。有没有办法检查?

Notice that there is no flag for a PMS color space. Is there a way to check that?

另外,我上传的一些文件,根本没有颜色空间标志。这是否意味着无法识别色彩空间?

Also, some files I upload, they don't have a color space flag at all. Does that mean that the color space can't be recognized?

我也想知道这是否是一种检查色彩空间的简单方法,或者是否有更好的策略?

I'm also wondering if this is a foolproof way to check the color space, or if there is a better strategy?

编辑:

我一直在环顾四周,我想你可以从图像的元数据中获取大量数据。 http://msdn.microsoft.com/en -us / library / xddt0dz7%28v = VS.90%29.aspx

I've been looking around, and I guess you can get a lot of data from the image's metadata. http://msdn.microsoft.com/en-us/library/xddt0dz7%28v=VS.90%29.aspx

有人知道元数据是否包含图像的色彩空间吗?

Does anyone know if the metadata contains the image's color space?

推荐答案

PMS 是一个色彩空间,而是一个色彩匹配系统(PANTONE色彩匹配系统) 。我非常怀疑你会发现任何流行的位图图像文件编解码器,它采用这种编码像素颜色的方法。相反,他们将PANTONE颜色编码为CMYK或RGB(或者可能是另一种颜色模型)之一。

PMS is not a color space, rather it is a system of color matching (PANTONE Color Matching System). I seriously doubt you will find any popular bitmap image file codecs that employ this method of encoding pixel color. Rather they will encode the PANTONE color as one of CMYK or RGB (or perhaps another color model).

像Postscript或PDF这样的矢量文件格式可能会嵌入包含然而,PMS参考,甚至那些格式通常需要相当于PMS编号的RGB或CMYK。

Vector file formats like Postscript or PDF may embed spot colors that contain the PMS reference, however, even those formats usually need the RGB or CMYK equivalent of the PMS number.

确定图像颜色模型的最佳方法是了解和理解文件格式本身。读取和解析原始文件头以确定底层数据是否存储为CMYK,RGB等并不难...

The best method of determining an images color model is to know and understand the file format itself. It is not hard to read and parse the raw file headers to determine if the underlying data is stored as CMYK, RGB, etc...

强大的工具包,例如Leadtools ,可以使这项任务比从.NET收集的任何内容更容易,更准确。

Robust toolkits, such as Leadtools, may make this task a bit easier and more accurate than anything you will gather from .NET.

这篇关于检测图像颜色空间是CMYK还是PMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆