How do you convert a System.Drawing.Bitmap
image to another type of image? I tried CType, which failed, since I do not know the type for .png or .jpg. I cannot find it anywhere on google either.
What is the most efficient method to do this while keeping the quality of the image as high as possible?
The system.Drawing.Bitmap class can handle opening and saving any kind of bitmap image, including JPG, PNG, GIF, BMP, and others.
To save an already opened file as a different format you can use the save method as so
MyImage.Save("ImageName.jpg",System.Drawing.Imaging.ImageFormat.Jpeg)
The class name of Bitmp refers more specifically to the general concept of storing a picture as a series of coloured pixels rather then the actual format of BMP, which is one possible way to store the representation of the pixels that make up an image.
Check out the Drawing.Bitmap.Save() method. I recommend saving as PNG - it's lossless and achieves reasonable compression. See the Imaging.ImageFormat enum - this is how you specify the image type you want.
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