How to convert the format of images in VB.NET?
To convert the format of an image you need to use the System.Drawing namespace. Using this code you can convert to a variety of graphic file formats, such as GIF or JPG.The following example converts a user prompted Bitmap image file into .Gif format.
File ImageConverter.vb
Imports System
Imports System.Drawing
Class ConvertImages
Shared Sub main()
Dim str As String
Console.Write("Path of the Image File to Convert :")
str = Console.ReadLine()
'Initialize the bitmap object by supplying the image file path
Dim bmp As New Bitmap(str)
bmp.Save(str + ".gif", System.Drawing.Imaging.ImageFormat.Gif)
Console.Write("Image Sucessfully Converted to " & str & ".gif")
End Sub
End Class
Written by Sandeep Mogulla, Webmaster at www.startvbdotnet.com
Index
Sponsored links
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
Add complete SSH and SFTP support to your .NET framework application
3 Months Free - ASP.NET Web Hosting
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!
