C# - How do I convert an image from one format to other?

By [)ia6l0 iii

Use the Image class from the System.Drawing Namespace.

var inputImage = System.Drawing.Image.FromFile(@"D:\Images\old.bmp");
inputImage.Save(@"D:\ConvertedImages\old.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

The above code converts a bitmap image to Jpeg.

Related FAQs

Explicity specify the NumberFormatInfo on the parse method of the int class and speed up the Parse Performance.
Use the Environment class to get important and user-specific properties like the User Profile folder.
There is no File.Rename method in C#. Use the System.IO.File.Move method instead.
Extension method to get the start of a day
Use the GetCommandLineArgs static method of the Environment class. It returns an array of the arguments.
Use the default keyword to find if an object is of Reference or Value type
C# - How do I convert an image from one format to other?  (1687 Views)