2005.06.21 09:17 "[Tiff] Tiff-Tags and Delphi7 / X and Y RESOLUTION / PHOTOMETRIC", by Matthias Lach

2005.07.06 10:18 "[Tiff] question of understanding / D7 and Var-Types", by Matthias Lach

Hello All!

http://199.98.20.129/courses/course_pages/past_courses/EE458/TIFF/

tells me
"
Basic Tags:
[...]
20. XResolution 282 RATIONAL 1
21. YResolution 283 RATIONAL 1
[...]
---

RATIONAL 5 Two LONG values. The first represents the numerator of a fraction, the second the denominator

"

I still need to write these 2 tags into my file. So i made these vars single:

" FirstPageYReso,FirstPageXReso: single; "

and read them for the only reaason to keep the reso and writeback these values as they where read out the original file. so i did:

OpenTiff:=TIFFOpen(FileListBox1.Filename,'r');

TIFFGetField(OpenTiff,TIFFTAG_XRESOLUTION,@FirstPageXReso) ;

    TIFFGetField(OpenTiff,TIFFTAG_YRESOLUTION,@FirstPageYReso);

and later

tifbild:=TIFFOpen(Output, 'w') ;

  TIFFSetField(tifbild, TIFFTAG_XRESOLUTION, FirstPageXReso);
  TIFFSetField(tifbild, TIFFTAG_YRESOLUTION, FirstPageYReso);

just to store the value.

if i make a output with showmessage(floattostr(FirstPageXReso)) i see the correct value of the original file (p.e. "204").

But the definetion above normaly means a value like "204.0" if i do so

( setting the value with a fixed value like TIFFSetField(tifbild, TIFFTAG_YRESOLUTION, 204.0); i get a floatingpoint error from delphi....

If i try TIFFSetField(tifbild, TIFFTAG_YRESOLUTION, 204); for setting a fixed value the output still shows me a "0".

the file can be written and looks ok, but if i check the values for the reso with p.e. "AsTiffTagViewer.exe" all i could read is a "0" ZERO. i tryed a lot allready but cant find my error.

any Hints?

(@Joris: I'll contact You Tuesday ;-) )

---
Mit freundlichen Gruessen