Hi, I am trying to resize a gif image I have on my server, and then stream it to the browser. (.net 2.0 & C#)
Unfortunately, the gif gets a bit distorted. I 've read a lot of walkthroughs, the dgi+ palette, etc etc but still haven't done it yet.
I have no problem using a third party component as long as its price is reasonable, and maybe the option to also edit multi-frame gifs.
Let me give you a small clue of what I've written so far:
void ServeTheImage(string fileName, string downloadExtension, int iWidth, int iHeight)
int original_width = 0;
int original_height = 0;
string WorkingDirectory = "/mw/";
string fullfilename = WorkingDirectory + fileName;
// create New image and bitmap objects. Load the image file and put into a resized bitmap.
System.Drawing.Image myImage = System.Drawing.Image.FromFile(Server.MapPath(fullfilename));
original_width = myImage.Width;
original_height = myImage.Height;
fixWidthHeight(ref original_width, ref original_height, ref iWidth, ref iHeight);
Bitmap b = Bitmap(iWidth, iHeight, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(b);
g.DrawImage(myImage, Rectangle(0, 0, 234, 30), Rectangle(0, 0, iWidth, iHeight), GraphicsUnit.Pixel);
System.Drawing.Image.GetThumbnailImageAbort dummyCallBack = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
System.Drawing.Image thumbNailImg = myImage.GetThumbnailImage(iWidth, iHeight, dummyCallBack, IntPtr.Zero);
Response.ContentType = "image/gif";
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
I have dtried to use the drawing classes but it seems they only work for jpeg.
For gif I get this:
A Graphics object cannot be created from an image that has an indexed pixel format.
Maybe a component would do better and easiest job?
By jobartley515 in forum VB Classic
Last Post: 10-03-2005, 12:01 AM
Last Post: 06-22-2005, 08:21 AM
Last Post: 02-18-2002, 03:34 PM
By Reg Ripperger in forum Web
Last Post: 07-30-2001, 10:33 AM
Last Post: 07-22-2000, 04:02 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL