简体   繁体   English

将ICC颜色配置文件应用于C#(Dotnet)中的图像

[英]Apply an ICC Color Profile to an image in C# (Dotnet)

How does one convert an image from one color profile to another (screen to printer, or scanner to screen). 如何将图像从一种颜色配置文件转换为另一种颜色配置文件(从屏幕到打印机,或从扫描仪到屏幕)。 In Visual C++ you would use the function in ICM.h, is there a managed way to do this with GDI+? 在Visual C ++中,您将使用ICM.h中的函数,是否有一种托管方式可以使用GDI +执行此操作?

I need to use GDI+, not WPF. 我需要使用GDI +,而不是WPF。 I'd prefer to have a managed solution, but if it is not available, I guess PInkvoke will have to suffice. 我更喜欢有一个托管解决方案,但如果它不可用,我猜PInkvoke就足够了。

There are a number of solutions. 有很多解决方案。

  1. For GDI+, check out this article at MSDN . 对于GDI +, 请查看MSDN上的这篇文章
  2. For WPF (.NET 3.0), see the System.Windows.Media namespace. 对于WPF(.NET 3.0),请参阅System.Windows.Media命名空间。 There are a number of different classes, such as the BitmapEncoder , that have the concept of a ColorContext , which "Represents the International Color Consortium (ICC) or Image Color Management (ICM) color profile that is associated with a bitmap image." 有许多不同的类,例如BitmapEncoder ,它们具有ColorContext的概念,“代表与位图图像相关联的国际色彩联盟(ICC)或图像颜色管理(ICM)颜色配置文件。”

Both of these seem pretty complex, so there's always the option of buying somebody else's code. 这两个看起来都很复杂,因此总是可以选择购买其他人的代码。 Atalasoft's DotImage Photo Pro has ICC profile setting capabilities built in. The code is expensive; AtalasoftDotImage Photo Pro内置了ICC配置文件设置功能。代码昂贵; a dev license is almost 2k. 开发许可证差不多是2k。 But based on their participation in the dotnet community, I'd give them a whirl. 但基于他们参与dotnet社区,我会给他们一个旋转。

You should take a look at Lcms . 你应该看看Lcms Its a colour management system, fairly complete, but written in C. you can use pinvoke, but I would recommend Managed C++ wrapper. 它是一个色彩管理系统,相当完整,但用C语言编写,你可以使用pinvoke,但我会推荐使用Managed C ++包装器。 I am actually currently working on a managed wrapper around the engine (just the basics, colour profile conversion, lab readings). 我实际上正在开发一个围绕引擎的托管包装器(只是基础知识,颜色配置文件转换,实验室读数)。 I can post a link to the code after i am complete. 我完成后可以发布代码链接。 It may be a week or so though. 可能是一周左右。

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

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