Re: resize gif image
- From: "sloan" <sloan@xxxxxxxxx>
- Date: Sun, 6 Jan 2008 23:44:30 -0500
http://www.c-sharpcorner.com/UploadFile/jacquesphilip/MakingThumbnailsOfTransparentImages11162005004933AM/MakingThumbnailsOfTransparentImages.aspx ?
"SushiSean" <SushiSean@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ABB99F98-370A-4E6A-82D4-29CAF3DA708F@xxxxxxxxxxxxxxxx
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?
.
- Prev by Date: Re: injecting javascript fails all the time?
- Next by Date: GridView, links and google-index
- Previous by thread: Re: System.OutOfMemoryException problem
- Next by thread: GridView, links and google-index
- Index(es):
Relevant Pages
|