GDI+ Image Encoder and Decoder Info

Encoders and Decoders




This piece of code enumerates every built in Encoder and Decoder that comes with GDI+.  You would use the same concept to gain informartion about any other Encoder/Decoder.







Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ImageDecoders() As Imaging.ImageCodecInfo = Imaging.ImageCodecInfo.GetImageDecoders
Dim ImageEncoders() As Imaging.ImageCodecInfo = Imaging.ImageCodecInfo.GetImageEncoders
Dim strInfo As String
Dim i As Integer

strInfo &= "Built-in GDI+ Image Decoders:" & ControlChars.NewLine & ControlChars.NewLine

For i = 0 To ImageDecoders.GetUpperBound(0)
With ImageDecoders(i)
strInfo &= "Codec Name: " & .CodecName & ControlChars.NewLine
strInfo &= "Dll Name: " & CType(IIf(.DllName <> String.Empty, .DllName, "N/A"), String) & _
ControlChars.NewLine
strInfo &= "File Extension(s): " & .FilenameExtension & ControlChars.NewLine
strInfo &= "Format Description: " & .FormatDescription & ControlChars.NewLine
strInfo &= "Mime Type: " & .MimeType & ControlChars.NewLine
strInfo &= "Version: " & .Version & ControlChars.NewLine & ControlChars.NewLine
End With
Next

strInfo = strInfo.Substring(0, strInfo.Length - 4)
txtDecoders.Text = strInfo

strInfo = ""
strInfo &= "Built-in GDI+ Image Encoders:" & ControlChars.NewLine & ControlChars.NewLine

For i = 0 To ImageEncoders.GetUpperBound(0)
With ImageEncoders(i)
strInfo &= "Codec Name: " & .CodecName & ControlChars.NewLine
strInfo &= "Dll Name: " & CType(IIf(.DllName <> String.Empty, .DllName, "N/A"), String) & _
ControlChars.NewLine
strInfo &= "File Extension(s): " & .FilenameExtension & ControlChars.NewLine
strInfo &= "Format Description: " & .FormatDescription & ControlChars.NewLine
strInfo &= "Mime Type: " & .MimeType & ControlChars.NewLine
strInfo &= "Version: " & .Version & ControlChars.NewLine & ControlChars.NewLine
End With
Next

strInfo = strInfo.Substring(0, strInfo.Length - 4)
txtEncoders.Text = strInfo
End Sub

You might also like...

Comments

Mitch ★

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens