Version: current trunk from svn
Compiler: FPC 2.5.1/Lazarus
Operating system: Windows 7 (x64)
JPEG throws exception when loading thru
aJPEG: TImagingGraphic;
...
aJPEG := TImagingGraphic.Create;
aJPEG.LoadFromFile('TMP68830.jpg');
aJPEG.Free;
The exception is thrown in "imaging.pas" (TMetadata.TranslateUnits) in line 3934, because the image does not contain any x or y resolution. In this case the call
XRes := UnitSize / XRes;
YRes := UnitSize / YRes;
causes an "div zero" exception. I recommend to check the content of "Xres" and "Yres" and if zero, set it to a default value (72 or 96dpi).
This is a working solution for the problem:
if XRes <=0 then Xres := 96;
if YRes <=0 then Yres := 96;
XRes := UnitSize / XRes;
YRes := UnitSize / YRes;
Regards
Bernd
Thanks for reporting this, I'll fix it right away.
New features in the trunk haven't been tested that much yet.