在.net 2.0将8位灰度TIFF图像为8位灰度JPG [英] Converting 8-bit grayscale tiff image to 8-bit grayscale jpg in .Net 2.0
问题描述
我们有一个系统,提供图像的8位灰度TIFF或JPG格式。但是,我们必须处理的图像组件需要的图像是在8位JPG格式。
We have a system that provides images in 8-bit grayscale either tiff or jpg formats. However, the component we have to process the images expects image to be in 8-bit jpg format.
当我使用的.Net保存TIFF图像为jpg它convets到24位的图像。
When I use .Net to save the tiff images as jpg it convets it to 24-bit image.
有没有一种方法,希望能简单快速,8位灰度TIFF图像转换为相当于JPG?
Is there a way, hopefully simple and fast, to convert 8-bit grayscale tiff images to equivalent jpg?
推荐答案
我试了又试刚刚得出结论,我很抱歉:NET库的Bitmap类不JPEG格式保存为8bpp,即使明确地陈述和数据是在灰度
I tried and tried just to conclude that I'm sorry: .Net library's Bitmap class DOES NOT save JPEG as 8bpp even when explicitly stated and data is in grayscale.
(注意:虽然在一些地方规定,JPEG格式不支持8bpp)。
(note: although stated in some places, JPEG format DOES support 8bpp).
在 C#,转换图像灰度你会发现code snipet转换为灰度的图片。
At C#, convert image to grayscale you may find code snipet to convert to grayscale any Image.
使用code,我能够保存.JPEG扩展名的8bpp灰度图像的实例,但指出ImageFormat.Gif ...这是个骗子......
Using that code, I was able to save a 8bpp grayscale Image instance with '.jpeg' extension, but stating ImageFormat.Gif... that's a cheat...
我的调查结果显示作为解决方案的一个完全不同的方法。
My findings show as solution an entirely different approach.
FreeImage库文件提供了强大的API,其中包括为您解决问题所需要的功能。
The FreeImage library offers powerful APIs, including the feature needed to solve your problem.
它的主页是 http://freeimage.sourceforge.net/faq.html
不过,我是不会轻易在我的Win2008 + VS 2010的机器编译。
But, I could not easily compile it in my Win2008 + VS 2010 machine.
应该有一个人出了很多汗,使其在现代环境中运行。
One ought to sweat a lot to make it run on modern environments.
这是如何完成被发现在的http://www.sambeauvois.be/blog/2010/05/freeimage-and-x64-projects-yes-you-can/
Some hints on how to accomplish that are found at http://www.sambeauvois.be/blog/2010/05/freeimage-and-x64-projects-yes-you-can/
祝你好运!
这篇关于在.net 2.0将8位灰度TIFF图像为8位灰度JPG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!