Is C# bitmap supporting saving the object to JPEG or PNG file format?
A png (Portable Network Graphics) file is a raster or bitmap image file format. A raster image is made up of a fixed number of pixels [or building blocks] that form a complete image. The image cannot be enlarged without distortion occurring.
JPEG and Bitmap are two different types of format used to store the images. JPEG: The full form JPEG is Joint Photographic Experts Group. And there are two extensions used to store image in this format, these are .
Common bitmap image file types include JPEG , GIF and PNG .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With