Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB7
Expertise: beginner
Nov 3, 2003



Application Security Testing: An Integral Part of DevOps

GetImageFormat - Retrieve the format of the input image, according on its extension

' Return the format of the input image, according on its extension
' Example: Dim imgFormat As System.Drawing.imaging.ImageFormat = GetImageFormat
' ("D:\sample.gif")

Function GetImageFormat(ByVal imgPath As String) As _
    imgPath = imgPath.ToLower()
    If imgPath.EndsWith(".bmp") Then
        Return System.Drawing.Imaging.ImageFormat.Bmp
    ElseIf imgPath.EndsWith(".emf") Then
        Return System.Drawing.Imaging.ImageFormat.Emf
    ElseIf imgPath.EndsWith(".gif") Then
        Return System.Drawing.Imaging.ImageFormat.Gif
    ElseIf imgPath.EndsWith(".ico") Then
        Return System.Drawing.Imaging.ImageFormat.Icon
    ElseIf imgPath.EndsWith(".jpg") OrElse imgPath.EndsWith(".jpeg") Then
        Return System.Drawing.Imaging.ImageFormat.Jpeg
    ElseIf imgPath.EndsWith(".png") Then
        Return System.Drawing.Imaging.ImageFormat.Png
    ElseIf imgPath.EndsWith(".tif") OrElse imgPath.EndsWith(".tiff") Then
        Return System.Drawing.Imaging.ImageFormat.Tiff
    ElseIf imgPath.EndsWith(".wmf") Then
        Return System.Drawing.Imaging.ImageFormat.Wmf
        Return System.Drawing.Imaging.ImageFormat.Gif
    End If
End Function
Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date