Mega Code Archive

 
Categories / VB.Net Tutorial / 2D Graphics
 

Convert jpeg to png

Imports System.Drawing.Imaging Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class MainClass    public Shared Sub Main         Dim imgCodecInfo As ImageCodecInfo = Nothing         Dim curBitmap As New Bitmap("yourfile.jpg")         Dim j As Integer         Dim mimeType As String = "image/png"         Dim encoders() As ImageCodecInfo         encoders = ImageCodecInfo.GetImageEncoders()         j = 0         While j < encoders.Length             If encoders(j).MimeType = mimeType Then                 imgCodecInfo = encoders(j)             End If         End While ' Save as png         curBitmap.Save("Shape0.png", imgCodecInfo, Nothing)         curBitmap.Dispose()    End Sub End class