name22

Read Dimensions From GIF Image File

Jun 17th, 2013
85
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $sFilePath = FileOpenDialog("Select GIF file", "", "GIF (*.gif)")
  2.  
  3. $aDim = _GIF_GetDimensions($sFilePath)
  4. ConsoleWrite("Width: " & $aDim[0] & @CRLF)
  5. ConsoleWrite("Height: " & $aDim[1] & @CRLF)
  6.  
  7. Func _GIF_GetDimensions($sGIF_Path)
  8.     Local $aGIF_Dim[2], $hGIF_File
  9.     $hGIF_File = FileOpen($sGIF_Path, 16)
  10.  
  11.     FileSetPos($hGIF_File, 6, 0)
  12.     $aGIF_Dim[0] = Int(FileRead($hGIF_File, 2))
  13.     $aGIF_Dim[1] = Int(FileRead($hGIF_File, 2))
  14.  
  15.     FileClose($hGIF_File)
  16.  
  17.     Return $aGIF_Dim
  18. EndFunc
RAW Paste Data