Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am getting "Parameter is not valid.", error on conversion of Pantones color tiff file into BitMap.
Code is below.
C++
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);
            }
        }
Posted
Updated 20-Jul-15 5:30am
v2

1 solution

TIFF has many (too many) formats, and most of them not supported by .NET Image/Bitmap classes...
You should check the LibTiff.NET[^] project...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900