ImageCodecInfo.GetImageEncoders : ImageCodecInfo « System.Drawing.Imaging « VB.Net by API






ImageCodecInfo.GetImageEncoders

  
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

   
    
  








Related examples in the same category

1.ImageCodecInfo.Compression
2.ImageCodecInfo.MimeType