Open GoogleCodeExporter opened 8 years ago
I encountered similar problem with JPEG output of some programs.
DateTimeOriginal had needles #0 char appended at the end which confused the
function
TryExifStringToDateTime in CCR.Exif unit.
In my case, this simple change fixed the problem: just add Trim to Length check:
function TryExifStringToDateTime(const S: string; var DateTime: TDateTime):
Boolean;
var
Year, Month, Day, Hour, Min, Sec: Integer;
begin //'2007:09:02 02:30:49'
// galfar: added Trim, some JPEGs have #0 appended to end
Result := (Length(Trim(S)) = 19) and (S[5] = ':') and (S[8] = ':') and
TryStrToInt(Copy(S, 1, 4), Year) and
TryStrToInt(Copy(S, 6, 2), Month) and
TryStrToInt(Copy(S, 9, 2), Day) and
TryStrToInt(Copy(S, 12, 2), Hour) and
TryStrToInt(Copy(S, 15, 2), Min) and
TryStrToInt(Copy(S, 18, 2), Sec) and
TryEncodeDateTime(Year, Month, Day, Hour, Min, Sec, 0, DateTime);
end;
Original comment by marekmauder@gmail.com
on 18 Jul 2013 at 12:44
Original issue reported on code.google.com by
ppau...@gmail.com
on 7 Mar 2013 at 12:31