Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx006.isp.belgacom.be (inmx006.isp.belgacom.be [195.238.2.106])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id iBLD3vVx030078
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Dec 2004 14:03:57 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx006.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id iBLD3bab011525
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Dec 2004 14:03:41 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id E10B7544F77; Tue, 21 Dec 2004 08:03:07 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from hotmail.com (bay17-dav7.bay17.hotmail.com [64.4.43.187])
	by xserve.flids.com (Postfix) with ESMTP id 61421544F41
	for <tiff@remotesensing.org>; Tue, 21 Dec 2004 08:03:05 -0500 (EST)
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
	Tue, 21 Dec 2004 05:03:02 -0800
Message-ID: <BAY17-DAV756BBACEA0A39DD5DE569CFA30@phx.gbl>
Received: from 82.223.50.187 by BAY17-DAV7.phx.gbl with DAV;
	Tue, 21 Dec 2004 13:02:06 +0000
X-Originating-IP: [82.223.50.187]
X-Originating-Email: [mgalanmolina@hotmail.com]
X-Sender: mgalanmolina@hotmail.com
From: =?iso-8859-1?Q?Manuel_Gal=E1n?= <mgalanmolina@hotmail.com>
To: <tiff@remotesensing.org>
Date: Tue, 21 Dec 2004 14:01:26 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4927.1200
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4927.1200
X-OriginalArrivalTime: 21 Dec 2004 13:03:02.0528 (UTC)
	FILETIME=[675C1800:01C4E75D]
Subject: [Tiff] Read X and Y Resolution
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============61093359252166335=="
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: b622c8e1c16ba4819de2c7bac965ae46

This is a multi-part message in MIME format.

--===============61093359252166335==
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0048_01C4E765.8FC17530"

This is a multi-part message in MIME format.

------=_NextPart_000_0048_01C4E765.8FC17530
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi list, this is my first message to the list. I'm begginer with the =
libtiffDelphi and i'm in trouble with the tiff resolution tags.

I'm using this code, in Delphi7:

/////////////////////////////////////////////////////////////////////////=
///////////////////////////////////////////////////////////
procedure TForm1.BitBtn1Click(Sender: TObject);
var
  han: PTIFF;
  m, u, resunit: Cardinal;
  xres, yres: integer;
begin
  if OpenDialog1.Execute then
  begin
    han:=3DTIFFOpen(OpenDialog1.Filename,'ru');
    if TIFFGetField(han, TIFFTAG_IMAGEWIDTH,@m)>0 then =
label1.caption:=3D inttostr(m);
    if TIFFGetField(han, TIFFTAG_IMAGELENGTH,@u)>0 then =
label2.caption:=3D inttostr(u);
    TIFFGetField(han, TIFFTAG_RESOLUTIONUNIT,@resunit);
    case  resunit of
     1: label5.caption:=3D '?';
     2: label5.caption:=3D 'inch';
     3: label5.caption:=3D 'cm';
    end;
    xres:=3D 0;
    yres:=3D 0;
    TIFFGetField(han, TIFFTAG_XRESOLUTION,@xres);
    TIFFGetField(han, TIFFTAG_yRESOLUTION,@yres);
    label3.caption:=3D inttostr(xres);
    label4.caption:=3D inttostr(yres);
  end;
end;
/////////////////////////////////////////////////////////////////////////=
/////////////////////////////////////////////////////////

when i define xres and yres as double i obtain 5.56078e-315=20
and when defined as integer i obtain 1125515264

but if i open the file with astifftagviewer i can see the correct =
resolution (150 pixels per inch)

What is wrong in my code? There is an example in delphi for that?

Thanks in advance

Manuel, from Spain


------=_NextPart_000_0048_01C4E765.8FC17530
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3700.6699" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi list, this is my first message to =
the list. I'm=20
begginer with the libtiffDelphi and i'm in trouble with the tiff =
resolution=20
tags.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm using this code, in =
Delphi7:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>////////////////////////////////////////////////////////////////=
////////////////////////////////////////////////////////////////////</FON=
T></DIV>
<DIV><FONT face=3DArial size=3D2>procedure TForm1.BitBtn1Click(Sender:=20
TObject);<BR>var<BR>&nbsp; han: PTIFF;<BR>&nbsp; m, u, resunit:=20
Cardinal;<BR>&nbsp; <STRONG>xres, yres: =
integer</STRONG>;<BR>begin<BR>&nbsp; if=20
OpenDialog1.Execute then<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;=20
han:=3DTIFFOpen(OpenDialog1.Filename,'ru');<BR>&nbsp;&nbsp;&nbsp; if=20
TIFFGetField(han, TIFFTAG_IMAGEWIDTH,@m)&gt;0 then label1.caption:=3D=20
inttostr(m);<BR>&nbsp;&nbsp;&nbsp; if TIFFGetField(han,=20
TIFFTAG_IMAGELENGTH,@u)&gt;0 then label2.caption:=3D=20
inttostr(u);<BR>&nbsp;&nbsp;&nbsp; TIFFGetField(han,=20
TIFFTAG_RESOLUTIONUNIT,@resunit);<BR>&nbsp;&nbsp;&nbsp; case&nbsp; =
resunit=20
of<BR>&nbsp;&nbsp;&nbsp;&nbsp; 1: label5.caption:=3D=20
'?';<BR>&nbsp;&nbsp;&nbsp;&nbsp; 2: label5.caption:=3D=20
'inch';<BR>&nbsp;&nbsp;&nbsp;&nbsp; 3: label5.caption:=3D=20
'cm';<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; xres:=3D=20
0;<BR>&nbsp;&nbsp;&nbsp; yres:=3D 0;<BR>&nbsp;&nbsp;&nbsp; =
TIFFGetField(han,=20
TIFFTAG_XRESOLUTION,@xres);<BR>&nbsp;&nbsp;&nbsp; TIFFGetField(han,=20
TIFFTAG_yRESOLUTION,@yres);<BR>&nbsp;&nbsp;&nbsp; label3.caption:=3D=20
inttostr(xres);<BR>&nbsp;&nbsp;&nbsp; label4.caption:=3D =
inttostr(yres);<BR>&nbsp;=20
end;<BR>end;</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>////////////////////////////////////////////////////////////////=
//////////////////////////////////////////////////////////////////</FONT>=
</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>when i define xres and yres as double i =
obtain=20
5.56078e-315 </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>and when defined as integer i obtain=20
1125515264</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>but if i open the file with =
astifftagviewer i can=20
see the correct resolution (150 pixels per inch)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>What is wrong in my code? There is an =
example in=20
delphi for that?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Manuel, from Spain</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0048_01C4E765.8FC17530--

--===============61093359252166335==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff

--===============61093359252166335==--
