Bitmap Palette Error after migrating to VS2008

J

jj

The following creates a copy of an image. It worked fine in Visual Studio
2005, but after installing Visual Studio 2008 then opening the solution as a
..net 2.0 project, I get an error on the 'bmpOut.Palette = imageFile.Palette'
line (see below).

Anyone come across this or suggest a reason for the error?


private static System.Drawing.Image CreateImageFile(System.Drawing.Image
imageFile, int width, int height)
{
System.Drawing.Bitmap bmpOut;
ImageFormat Format = imageFile.RawFormat;
bmpOut = new Bitmap(width, height,
PixelFormat.Format64bppPArgb);
bmpOut.SetResolution(imageFile.HorizontalResolution,
imageFile.VerticalResolution);
/ /***** bmpOut.Palette = imageFile.Palette;***** CAUSES ERROR
'INVALID PARAMETER//
Graphics g = Graphics.FromImage(bmpOut);
g.InterpolationMode =
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.SmoothingMode =
System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.PixelOffsetMode =
System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.CompositingQuality =
System.Drawing.Drawing2D.CompositingQuality.HighQuality;

g.FillRectangle(Brushes.White, 0, 0, width, height);
g.DrawImage(imageFile, 0, 0, width, height);
imageFile.Dispose();
g.Dispose();
return bmpOut;
}
 
J

jj

Weird. Thought someone might know the answer to this one. I can't work out
why this no longer works in VS2008
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top