Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Information

Status
Not open for further replies.

ginzing

Programmer
Jul 3, 2001
7
ZA
Hi

I need to write code to read the height, width and size of an image file. I am looking for code with an API that supports the following file formats; gif, jpegs, bmps and if possible an API I can use to query the same information for video files; avi and mpegs as well?

Can someone please help.

Gin
:cool:
 
Hi,

I don't know much about graphics actually, but I do know that this is a LOT of coding.

I got this for AVI atleast...

Private Const OF_SHARE_DENY_WRITE As Long = &H20
Private Type AVIFileInfo
dwMaxBytesPerSec As Long
dwFlags As Long
dwCaps As Long
dwStreams As Long
dwSuggestedBufferSize As Long
dwWidth As Long
dwHeight As Long
dwScale As Long
dwRate As Long
dwLength As Long
dwEditCount As Long
szFileType As String * 64
End Type
Private Declare Function AVIFileOpen Lib "avifil32" Alias "AVIFileOpenA" (ppfile As Long, ByVal szFile As String, ByVal mode As Long, pclsidHandler As Any) As Long
Private Declare Function AVIFileRelease Lib "avifil32" (ByVal pfile As Long) As Long
Private Declare Function AVIFileInfo Lib "avifil32" Alias "AVIFileInfoA" (ByVal pfile As Long, pfi As AVIFileInfo, ByVal lSize As Long) As Long
Private Declare Sub AVIFileInit Lib "avifil32" ()
Private Declare Sub AVIFileExit Lib "avifil32" ()
Private Sub Form_Load()
Dim hFile As Long, AviInfo As AVIFileInfo

AVIFileInit

If AVIFileOpen(hFile, "c:\avifile.avi", OF_SHARE_DENY_WRITE, ByVal 0&) = 0 Then

If AVIFileInfo(hFile, AviInfo, Len(AviInfo)) = 0 Then
MsgBox "AVI dimensions: " + CStr(AviInfo.dwWidth) + "x" + CStr(AviInfo.dwHeight)
Else
MsgBox "Error while retrieving AVI information..."
End If

AVIFileRelease hFile
Else
MsgBox "Error while opening the AVI file..."
End If

AVIFileExit
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top