Hello Batik Fellows,
I must tell you that I'm very fond of Batik now that it works smoothly
in our project. I'll do some advertising for it here in our company :-)
I still want to optimize things. The multipage TIFF that I generate is
yet not compressed. With Packbits compression, I always have a corrupt
result. The message that I get when analysing the file is:
K:\local\bin\nt>tiffvalidator c:\DetailedWithCompanyLogo.tif
TIFF Directory at offset 0x8
Image Width: 1076 Image Length: 1523
Resolution: 150, 150
Bits/Sample: 8
Compression Scheme: CCITT RLE
Photometric Interpretation: RGB color
Samples/Pixel: 3
Rows/Strip: 8
Planar Configuration: single image plane
TIFFFillStrip: c:\DetailedWithCompanyLogo.tif: Read error on strip 0;
got 0 bytes, expected 25824.
Status=[CORRUPTED]
The code that I use is below:
//NOTES
// bufferedImagesList is a Vector containing FormatRed objects of type
TYPE_3BYTE_BGR and the sample model PixelInterleavedSampleModel
//renderedImage is a FormatRed object of the same type and sample models
as the bufferedImagesList objects
TIFFEncodeParam encodeParam = new TIFFEncodeParam();
//this is for the multipage output
encodeParam.setExtraImages(bufferedImagesList.iterator());
//set the image resolution to 150
TIFFField[] extras = new TIFFField[2];
extras[0] = new TIFFField(282, TIFFField.TIFF_RATIONAL, 1,
(Object)new long[][] {{(long)150, (long)1},{(long)0 ,(long)0}});
extras[1] = new TIFFField(283, TIFFField.TIFF_RATIONAL, 1,
(Object)new long[][] {{(long)150, (long)1},{(long)0 ,(long)0}});
encodeParam.setExtraFields(extras);
//this should be for the compression
encodeParam.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS);
//and now... encode it!
OutputStream outputStream = new FileOutputStream (outputFilename);
TIFFImageEncoder encoder = new TIFFImageEncoder (outputStream,
encodeParam);
encoder.encode(renderedImage);
outputStream.close();
outputStream = null;
[...]
I wonder if it is supposed to work. Did you encounter a similar
situation?
Thanks a lot in advance,
Felicia
--
------------------------------------------------------------
Felicia IONASCU Oc� Print Logic Technologies
mailto:[EMAIL PROTECTED] 1, rue Jean Lemoine
phone : +33 (0)1 48 98 81 99 94015 Cr�teil cedex, France
fax: +33 (0)1 48 98 54 50 http://www.oce.com/
------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]