VB.NET - Code Samples - Code Snippet
VB.NET Open and Save Images
Synopsis:
VB.Net makes opening images in a variety of formats and saving them incredibly easy using the system.drawing namespace. With only a few lines of code you can open an image in several formats and then save them to the same or another format. This code won't work for multi-image files such as tiff but you can use the drawing namespace to handle that with a bit more work. Here is the list of available formats: bmp,emf,exif,gif,Icon,jpeg,png,tiff,wmf.
The Code:
'open a file Dim image As Drawing.Image image = image.FromFile(somefilepath) 'opens file in any format 'save file Image.Save(somefilepath, Drawing.Imaging.ImageFormat.Bmp) 'save to bmp format Image.Save(somefilepath, Drawing.Imaging.ImageFormat.Jpeg) 'save to jpeg format 'etc