My implementation:
1: Public Function IsAnimatedGif(ByVal szFilename As String) As Boolean
2:
3: Dim fi As New System.IO.FileInfo(szFilename)
4:
5: Dim nFrameCount As Integer = 0
6:
7: If fi.Extension.ToLowerInvariant() = ".gif" Then
8:
9: Try
10: Using _img As Image = New Bitmap(szFilename)
11: Dim fd As System.Drawing.Imaging.FrameDimension = New System.Drawing.Imaging.FrameDimension(_img.FrameDimensionsList(0))
12: nFrameCount = _img.GetFrameCount(fd)
13: End Using
14: Catch ex As Exception
15: 'Failed to load image, bad file?
16: End Try
17:
18: End If
19:
20: Return (nFrameCount > 1)
21:
22: End Function
See
and
No comments:
Post a Comment