TImgInfo = record
width:integer;
height:integer;
dpx:integer;
dpy:integer;
error:string;
end;
//.....
function Tprinc.getImgInfo(name:TFileName):TImgInfo ;
var
fginfo:TGFL_FILE_INFORMATION;
e: GFL_ERROR;
ris:TImgInfo;
begin
e:=gflGetFileInformation(Pchar(name),-1,fginfo);
if (e <> gfl_no_error) then
ris.error:='Error :'+gflGetErrorString(e)
else begin
ris.error:='';
ris.width:=fginfo.Width;
ris.height:=fginfo.Height;
ris.dpx:=fginfo.Xdpi;
ris.dpy:=fginfo.Ydpi;
gflFreeFileInformation(fginfo);
end;
result:=ris;
end;
The problem it is that Sometimes the Ydpi and Xdpi is equal 0 and I can't see the real value of the DPi 's image.
Is it a Bug?
How can I fix this?
xnview wrote:If X/YDpi are 0, so there is no DPI information in the file...
how is it possible? it is a Jpeg file! And in this case How can I get this information? (with another component I get this information by the same file or If I open with Photoshop I See that the image has DPi information)
gflGetDefaultLoadParams(lo);
lo.DefaultAlpha:= 255;
lo.ColorModel := GFL_BGR;
e:=gflLoadBitmap(pchar(nome),pgbmp,lo,fginfo);
if (e <> gfl_no_error) then
ris.errore:='Errore :'+gflGetErrorString(e)
else
ris.errore:='';
inf:=gflBitmapGetEXIF(pgbmp,0);
(* it go in error when it execute this istruction ->*) for i:=0 to inf.NumberOfItems-1 do
begin
showmessage(inf.ItemsList[i].Name+' '+inf.ItemsList[i].value);
end;