Page 1 of 1
[DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 12:02 pm
by enter
Hi,
I create this function to get image file information :
Code: Select all
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?
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 1:07 pm
by xnview
If X/YDpi are 0, so there is no DPI information in the file...
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 2:01 pm
by enter
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)
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 2:04 pm
by xnview
Even a jpeg file can't have DPI info.
So it's EXIF DPI for your problem, i think...
gflGetEXIFDPI
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 2:13 pm
by enter
xnview wrote:Even a jpeg file can't have DPI info.
So it's EXIF DPI for your problem, i think...
gflGetEXIFDPI
I don't understand, What Should I do? gflGetEXIFDPI function it does not exists.
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 2:33 pm
by xnview
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 2:55 pm
by enter
ok
Code: Select all
GFL_EXIF_DATA* gflBitmapGetEXIF(
const GFL_BITMAP* bitmap,
GFL_UINT32 flags
);
flags?
I try with this :
Code: Select all
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;
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 5:48 pm
by enter
It does not work!
I don't understand why gflGetFileInformation function does not work well with images!
the gflGetEXIFDPI is very complicated funcion and without an example it's very hard to understand how it work..
I need to konow as fast as possibile the information of any images (width, length, dpi), Is it possible with the GFL SDK?
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Mon Nov 22, 2010 8:00 pm
by xnview
The problem is that for your picture, DPI are not stored in the header but in metadata...
Ok, currently it's not easy. I can add a flag. Could you send me your email?
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Tue Nov 23, 2010 8:04 am
by enter
xnview wrote:The problem is that for your picture, DPI are not stored in the header but in metadata...
Ok, currently it's not easy. I can add a flag. Could you send me your email?
I sent you a PM!
Thanks!
Re: [DELPHI] :gflGetFileInformation - DPi bug
Posted: Tue Nov 23, 2010 9:39 am
by enter
(ERRATA CORRIGE)
I sended you a new PM where I wrote my email correctly!
sorry for mistake!