[vb.net] VB.NET에서 이미지 GUID를 사용하여 이미지 유형 확인

하나를하더라도최선을 2020-05-23 16:55:04 51,369 0 0



        Dim image As System.Drawing.Image = SafeImageFromFile(FilePath)
        Dim FormetType As String = String.Empty
        If image.RawFormat.Guid = System.Drawing.Imaging.ImageFormat.Tiff.Guid Then
            FormetType = "TIFF"
        ElseIf image.RawFormat.Guid = System.Drawing.Imaging.ImageFormat.Gif.Guid Then
            FormetType = "GIF"
        ElseIf image.RawFormat.Guid = System.Drawing.Imaging.ImageFormat.Jpeg.Guid Then
            FormetType = "JPG"
        ElseIf image.RawFormat.Guid = System.Drawing.Imaging.ImageFormat.Bmp.Guid Then
            FormetType = "BMP"
        ElseIf image.RawFormat.Guid = System.Drawing.Imaging.ImageFormat.Png.Guid Then
            FormetType = "PNG"
        ElseIf image.RawFormat.Guid = System.Drawing.Imaging.ImageFormat.Icon.Guid Then
            FormetType = "ICO"
        Else
            Throw New System.ArgumentException("Invalid File Type")
        End If
        image.Dispose()


댓글 0개

첫 번째 댓글을 작성해보세요!