如何获取JPEG文件属性的摘要内容(70分)

  • 主题发起人 主题发起人 sst0710
  • 开始时间 开始时间
S

sst0710

Unregistered / Unconfirmed
GUEST, unregistred user!
如何获取JPEG文件属性的摘要内容
 
procedure GetJpgInfo(const AFileName: string; var AJpgWdh, AJpgHt: Integer);<br>var<br> &nbsp;Jpg: TJpegImage;<br>begin<br> &nbsp;if not fileexists(AFileName) then<br> &nbsp; &nbsp;exit;<br> &nbsp;Jpg := TJPEGImage.Create;<br> &nbsp;Jpg.LoadFromFile(AFileName);<br> &nbsp;Jpg.Width := AJpgWdh;<br> &nbsp;Jpg.Height := AJpgHt;<br> &nbsp;Jpg.Free;<br>end;
 
Function ReadExifDate(var sDate:string; FileName : String) : Boolean;<br>Const<br> &nbsp;Numbers9 : Set of Char = ['0'..'9'];<br> &nbsp;Numbers1 : Set of Char = ['0'..'1'];<br> &nbsp;Numbers3 : Set of Char = ['0'..'3'];<br> &nbsp;Numbers5 : Set of Char = ['0'..'5'];<br> &nbsp;MaxItems &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = $9FF; <br>Var<br> &nbsp;f &nbsp; &nbsp; &nbsp;: File of Char;<br> &nbsp;s &nbsp; &nbsp; &nbsp;: String;<br> &nbsp;i,j &nbsp; &nbsp;: Integer;<br> &nbsp;a &nbsp; &nbsp; &nbsp;: Array[0..MaxItems] of Char;<br>Begin<br> &nbsp;Result := False; <br> &nbsp;sDate := ''; &nbsp; &nbsp;<br> &nbsp;s := ''; <br> &nbsp;AssignFile(f, Filename);<br> &nbsp;Filemode := 0; <br> &nbsp;Reset(f);<br> &nbsp;For I := 0 to MaxItems do Begin<br> &nbsp; &nbsp;If not Eof(f) then<br> &nbsp; &nbsp; &nbsp;Read(f,a); <br> &nbsp;End;<br> &nbsp;CloseFile(f);<br><br> &nbsp;s := a[6] + a[7] + a[ 8 ] + a[9]; <br> &nbsp;If ANSIUppercase(s) = 'EXIF' then <br> &nbsp; &nbsp;Result := True<br> &nbsp;else<br> &nbsp; &nbsp;Exit; <br> &nbsp;For I := 10 to MaxItems - 15 do Begin<br> &nbsp; &nbsp;If a = ':' then Begin<br> &nbsp; &nbsp; &nbsp;s := '';<br> &nbsp; &nbsp; &nbsp;For j := 0 to 18 do<br> &nbsp; &nbsp; &nbsp; &nbsp;s := s + a[i + j - 4]; <br> &nbsp; &nbsp; &nbsp;If <br> &nbsp; &nbsp; &nbsp; &nbsp;(s[01] in Numbers9) and &nbsp;(s[02] in Numbers9) and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[03] in Numbers9) and &nbsp;(s[04] in Numbers9) and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[05] = ':') &nbsp; &nbsp; &nbsp; and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[06] in Numbers1) and &nbsp;(s[07] in Numbers9) and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[08] = ':') &nbsp; &nbsp; &nbsp; and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[09] in Numbers3) and &nbsp;(s[10] in Numbers9) and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[11] = ' ') &nbsp; &nbsp; &nbsp; and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[12] in Numbers5) and &nbsp;(s[13] in Numbers9) and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[14] = ':') &nbsp; &nbsp; &nbsp; and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[15] in Numbers5) and &nbsp;(s[16] in Numbers9) and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[17] = ':') &nbsp; &nbsp; &nbsp; and<br> &nbsp; &nbsp; &nbsp; &nbsp;(s[18] in Numbers5) and &nbsp;(s[19] in Numbers9) then Begin<br> &nbsp; &nbsp; &nbsp; &nbsp; sDate := s;<br> &nbsp; &nbsp; &nbsp; &nbsp; If sDate = '0000:00:00 00:00:00' then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ShowMessage('Illegal datetime found!');<br> &nbsp; &nbsp; &nbsp; &nbsp; Exit; <br> &nbsp; &nbsp; &nbsp;End;<br> &nbsp; &nbsp;End;<br> &nbsp;End;<br>End;
 
后退
顶部