AWARE [SYSTEMS]
AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
June 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2005.06.09 12:49 "TIFF save", by Matthias Lach
2005.06.09 14:55 "Re: TIFF save", by Joris Van Damme
2005.06.09 16:25 "Re: TIFF save", by Michel Salvagniac
2005.06.10 12:33 "WG: [Tiff] TIFF save", by Matthias Lach

2005.06.10 12:33 "WG: [Tiff] TIFF save", by Matthias Lach

> Assuming you can get save or put your image data in a bitmap, this
> code can be helpful (it was for me). I use G4 compression. var
> 
>    resoTiff:=200.0;
 
why u set a fix value here?
mAy i read this from the original file an put it in a variable and
use it in the saveprocedure? 

>    hauteur:=BMP.Height;
>    largeur:=BMP.Width;
> 
> imgtif:=TIFFOpen('test.tif', 'w') ;
>   TIFFSetField(imgtif, TIFFTAG_IMAGEWIDTH, largeur);
>   TIFFSetField(imgtif, TIFFTAG_IMAGELENGTH, hauteur);
>   TIFFSetField(imgtif, TIFFTAG_BITSPERSAMPLE, 1);
>   TIFFSetField(imgtif, TIFFTAG_SAMPLESPERPIXEL, 1);
>   TIFFSetField(imgtif, TIFFTAG_ROWSPERSTRIP, hauteur);
 
I used this and i get a file in faxG4(or G3 as below) format - i can
change to ccittfaxg3 this works fine. 
 
But my original image is a fax, white background, black text and has
this values from "asTifTagViewer": 
---
ImageWidth (1 Long): 1728
ImageLength (1 Long): 2347
BitsPerSample (1 Short): 1
Compression (1 Short): Group 3 Fax (aka CCITT FAX3) 
Photometric (1 Short): MinIsWhite 
FillOrder (1 Short): Lsb2Msb 
StripOffsets (1 Long): 8 
SamplesPerPixel (1 Short): 1 
RowsPerStrip (1 Short): 2347
StripByteCounts (1 Long): 15321 
XResolution (1 Rational): 204
YResolution (1 Rational): 196 
Group3Options (1 Long): 0
ResolutionUnit (1 Short): Inch 
---    

the outputfile from above has:
---
ImageWidth (1 Short): 1728
ImageLength (1 Short): 2251
BitsPerSample (1 Short): 1
Compression (1 Short): Group 3 Fax (aka CCITT FAX3) 
Photometric (1 Short): MinIsWhite 
FillOrder (1 Short): Msb2Lsb 
StripOffsets (1 Long): 8 
SamplesPerPixel (1 Short): 1 
RowsPerStrip (1 Short): 2251
StripByteCounts (1 Long): 24341 
XResolution (1 Rational): 200
YResolution (1 Rational): 200 
PlanarConfig (1 Short): Contig
ResolutionUnit (1 Short): Inch 
Software (14 ASCII): LibTiffDelphi
Artist (26 ASCII): none 
---     

if i open the file from the output above, AcDsee says "file corrupt"
and it looks the other way round - background is black and text is
white.  
and it looks jolted a bit

sampels wrong output:  http://de.geocities.com/der_maxem/test.tif
(24604 byte) (less lines as the original because i cut 96 Lines off
with my projecttool)  

original file :       
http://de.geocities.com/der_maxem/61_zeilen.tif (15520 byte) (more
lines, because it is the original file - uncut) 
 
 
---
Mit freundlichen Gruessen

Matthias Lach