S
SushiSean
Hello. I have something like image gallery and I need make preview of images.
It means resize them to 100x100.
I have code
// create Graphics object
System.Drawing.Image oThumbNail = new Bitmap(FileWidth, FileHeight,
oImg.PixelFormat);
Graphics oGraphic = Graphics.FromImage(oThumbNail);
oGraphic.CompositingQuality = CompositingQuality.HighQuality;
oGraphic.SmoothingMode = SmoothingMode.HighQuality;
oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
//make rectangle from Graphics object (resize)
Rectangle oRectangle = new Rectangle(0, 0, FileWidth, FileHeight);
oGraphic.DrawImage(oImg, oRectangle);
oThumbNail.Save(NewPhysicalPath);
It works well for jpeg images, but I get error when work with gif
"A Graphics object cannot be created from an image that has an indexed pixel
format."
What can I do here?
It means resize them to 100x100.
I have code
// create Graphics object
System.Drawing.Image oThumbNail = new Bitmap(FileWidth, FileHeight,
oImg.PixelFormat);
Graphics oGraphic = Graphics.FromImage(oThumbNail);
oGraphic.CompositingQuality = CompositingQuality.HighQuality;
oGraphic.SmoothingMode = SmoothingMode.HighQuality;
oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
//make rectangle from Graphics object (resize)
Rectangle oRectangle = new Rectangle(0, 0, FileWidth, FileHeight);
oGraphic.DrawImage(oImg, oRectangle);
oThumbNail.Save(NewPhysicalPath);
It works well for jpeg images, but I get error when work with gif
"A Graphics object cannot be created from an image that has an indexed pixel
format."
What can I do here?