我觉得jpeg 文件的拍摄日期可以通过创建日期或者修改日期来获取(如果要求不是很精确的话)
function GetFileTime(const AFN: string): TDateTime;
var
fh: HWND;
lpFileInfo: _BY_HANDLE_FILE_INFORMATION;
ST: TSystemTime;
{
_BY_HANDLE_FILE_INFORMATION = record
dwFileAttributes: DWORD;
//后缀名
ftCreationTime: TFileTime;
//创建时间
ftLastAccessTime: TFileTime;
//最后访问时间
ftLastWriteTime: TFileTime;
//最后修改时间
dwVolumeSerialNumber: DWORD;
nFileSizeHigh: DWORD;
nFileSizeLow: DWORD;
nNumberOfLinks: DWORD;
nFileIndexHigh: DWORD;
nFileIndexLow: DWORD;
end;
}
begin
if FileExists(AFN) then
begin
fh := FileOpen(AFN, fmOpenRead);
GetFileInformationByHandle(fh, lpFileInfo);
FileTimeToSystemTime(lpFileInfo.ftCreationTime, ST);
Result := EncodeDate(ST.wYear, ST.wMonth, ST.wDay);
FileClose(fh);
end
else
Result := 0;
end;