Re: resize gif image



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?



.



Relevant Pages

  • Re: Writing Text on an Image.
    ... Create a new System.Drawing.Bitmap class and load it with the image ... Get a graphics object from the Bitmap using Graphics.FromImage ... > images and use it for there own purpose. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Writing Text on an Image.
    ... "James Westgate" wrote: ... Get a graphics object from the Bitmap using Graphics.FromImage ... >> but the design is still visible. ... >> images and use it for there own purpose. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: problem with resizing 32bppArgb images
    ... resolution difference - when drawing to the screen the graphics object ... are making images smaller than the original screen image, ... scaled images now look "perfect" on the screen. ... send that to the graphics service or whatever is feeding the printer. ...
    (microsoft.public.dotnet.framework.drawing)
  • Change a bitmap
    ... Does anyone know how I can draw some images onto a ... background image and then save the image to a file? ... but I can't figure out how to save the graphics object to ...
    (microsoft.public.dotnet.framework.drawing)