Pantonescolor tiff文件在位图转换中抛出错误。 [英] Pantonescolor tiff file throwing an error in Bitmap conversion.

查看:68
本文介绍了Pantonescolor tiff文件在位图转换中抛出错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到参数无效。,将Pantones颜色tiff文件转换为BitMap时出错。

代码如下。

I am getting "Parameter is not valid.", error on conversion of Pantones color tiff file into BitMap.
Code is below.

static Bitmap RedrawImage(string FileName, int TargetSize)
        {
            try
            {
                Bitmap newImage;
                using (Bitmap oldImage = new Bitmap(FileName))
                {
                    Size newSize = CalcuateDimentions(oldImage.Size, TargetSize);
                    newImage = new Bitmap(newSize.Width, newSize.Height, PixelFormat.Format24bppRgb);

                    Graphics canvas = Graphics.FromImage(newImage);
                    canvas.SmoothingMode = SmoothingMode.HighQuality;
                    canvas.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    canvas.PixelOffsetMode = PixelOffsetMode.HighQuality;

                    canvas.DrawImage(oldImage, new System.Drawing.Rectangle(new Point(0, 0), newSize));
                    oldImage.Dispose();
                }
                return newImage;
            }
            catch (Exception ex)
            {
                throw new Exception("Error attempting to redraw the image", ex);
            }
        }

推荐答案

TIFF有很多(太多)格式,其中大部分都不受支持.NET图像/位图类...

您应该检查 LibTiff.NET [ ^ ]项目......
TIFF has many (too many) formats, and most of them not supported by .NET Image/Bitmap classes...
You should check the LibTiff.NET[^] project...


这篇关于Pantonescolor tiff文件在位图转换中抛出错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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