$hFile = FileOpen("0001.jpg", 16)
$bData = FileRead($hFile, 1024)
FileClose($hFile)
$tagJPEG = "byte Header[6];char JFIF[5];byte Version[2];byte DensityUnits;byte XPixel[2];byte YPixel[2];ubyte XZoomPixel;ubyte YZooomPixel;byte Signature[2]"
$tBinary = DllStructCreate("byte Binary[1024]")
$pBuffer = DllStructGetPtr($tBinary)
$tBuffer = DllStructCreate($tagJPEG, $pBuffer)
DllStructSetData($tBinary, "Binary", $bData)
$tBuffer1 = $tBuffer
If (DllStructGetData($tBuffer, "Signature") = "0xFFDB") Then
$pBuffer += DllStructGetSize($tBuffer) + 69 + 67
Else
$pBuffer += DllStructGetSize($tBuffer) - 2
EndIf
$tBuffer = DllStructCreate("byte Signature[2]", $pBuffer)
If (DllStructGetData($tBuffer, "Signature") = "0xFFFE") Then
$pBuffer += DllStructGetSize($tBuffer)
$tBuffer = DllStructCreate("byte CommentBytes[2]", $pBuffer)
$pBuffer += Number(String(DllStructGetData($tBuffer, "CommentBytes")))
Else
$pBuffer += DllStructGetSize($tBuffer) - 2
EndIf
$tBuffer = DllStructCreate("byte Signature[2]", $pBuffer)
Switch DllStructGetData($tBuffer, "Signature")
Case ("0xFFC0")
$pBuffer += 4
Case ("0xFFDB")
$pBuffer += 67 * 2 + 8
EndSwitch
$tBuffer = DllStructCreate("byte Accuracy;byte Height[2];byte Width[2]", $pBuffer)
$sInfo = ""
$sInfo = "X DPI: " & Number(String(DllStructGetData($tBuffer1, "XPixel"))) & @CRLF
$sInfo &= "Y DPI: " & Number(String(DllStructGetData($tBuffer1, "YPixel"))) & @CRLF
$sInfo &= "Width: " & Number(String(DllStructGetData($tBuffer, "Width"))) & @CRLF
$sInfo &= "Height: " & Number(String(DllStructGetData($tBuffer, "Height"))) & @CRLF
$sInfo &= "Accuracy: " & Number(String(DllStructGetData($tBuffer, "Accuracy"))) & @CRLF
Msgbox(0, "", $sInfo)
|