[DELPHI] :gflGetFileInformation - DPi bug

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

Post Reply
enter
Posts: 7
Joined: Mon Nov 22, 2010 11:54 am

[DELPHI] :gflGetFileInformation - DPi bug

Post by enter » Mon Nov 22, 2010 12:02 pm

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?

User avatar
xnview
Author of XnView
Posts: 31607
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by xnview » Mon Nov 22, 2010 1:07 pm

If X/YDpi are 0, so there is no DPI information in the file...
Pierre.

enter
Posts: 7
Joined: Mon Nov 22, 2010 11:54 am

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by enter » Mon Nov 22, 2010 2:01 pm

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)

User avatar
xnview
Author of XnView
Posts: 31607
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by xnview » Mon Nov 22, 2010 2:04 pm

Even a jpeg file can't have DPI info.

So it's EXIF DPI for your problem, i think...
gflGetEXIFDPI
Pierre.

enter
Posts: 7
Joined: Mon Nov 22, 2010 11:54 am

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by enter » Mon Nov 22, 2010 2:13 pm

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.

User avatar
xnview
Author of XnView
Posts: 31607
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by xnview » Mon Nov 22, 2010 2:33 pm

Pierre.

enter
Posts: 7
Joined: Mon Nov 22, 2010 11:54 am

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by enter » Mon Nov 22, 2010 2:55 pm

xnview wrote:Sorry gflBitmapGetEXIF
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;

enter
Posts: 7
Joined: Mon Nov 22, 2010 11:54 am

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by enter » Mon Nov 22, 2010 5:48 pm

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?

User avatar
xnview
Author of XnView
Posts: 31607
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by xnview » Mon Nov 22, 2010 8:00 pm

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?
Pierre.

enter
Posts: 7
Joined: Mon Nov 22, 2010 11:54 am

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by enter » Tue Nov 23, 2010 8:04 am

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!

enter
Posts: 7
Joined: Mon Nov 22, 2010 11:54 am

Re: [DELPHI] :gflGetFileInformation - DPi bug

Post by enter » Tue Nov 23, 2010 9:39 am

(ERRATA CORRIGE)

I sended you a new PM where I wrote my email correctly!

sorry for mistake!

Post Reply