hi..i don't know how to convert an image from one format to another format in runtime using c#...for example converting a gif image to jpeg..if anyone knows please help me...thanks...

Hey hey,

this is an old VB ASP.net project i did, shouldnt be too hard for you to change the syntax.

Dim memSt As New System.IO.MemoryStream
        Dim imgMe As Drawing.Image = Drawing.Image.FromFile(Server.MapPath("me.jpg")) ' Get image
        
        imgMe.Save(memSt, Drawing.Imaging.ImageFormat.Gif) ' Save image to memory stream
        memSt.WriteTo(Response.OutputStream)

this example outputs the image to the output stream. you need to use a memory stream and not save it directly as when using this method with png's and bmp's the server outputs the image while it is not fully proccessed resulting in no image.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.