Can bitmap object be save as PNG or JPEG file format
Bitmap extends Image, therefore you can call: Image.Save (String, ImageFormat)
. For example:
using System.Drawing
// ...
Bitmap img = new Bitmap("file.jpg");
img.Save("file.png", ImageFormat.Png); // ImageFormat.Jpeg, etc
Omitting the second argument and just calling Image.Save(String)
will save the image as its raw format.
In addition to last post (can't comment existing post since i'm new here)
File type is NOT based off of the extension. Just try to do img.Save("result.bmp") and Image.Save("result.bmp", ImageFormat.Bmp);
and you'll see that file sizes are dramatically different.