Bitmap bitmap = new Bitmap("image.bmp"); bitmap.Save("image.png", ImageFormat.Png);
Bitmap bitmap = new Bitmap("image.bmp"); EncoderParameters parameters = new EncoderParameters(1); parameters.Param[0] = new EncoderParameter(Encoder.Quality, 80L); // set compression level to 80 ImageCodecInfo codecInfo = ImageCodecInfo.GetImageEncoders().FirstOrDefault(codec => codec.FormatID == ImageFormat.Jpeg.Guid); bitmap.Save("image.jpg", codecInfo, parameters);In this example, a bitmap image is loaded from a file named "image.bmp", then it is saved as a JPEG file named "image.jpg". The `EncoderParameters` object is used to set the compression level to 80. The `ImageCodecInfo` object is used to specify the JPEG file format. Overall, System.Drawing Image Save is a powerful method for saving images in various file formats. It is part of the System.Drawing.dll library in C#.