xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felicia Ionascu <...@ocegr.fr>
Subject Re: problem when encoding compressed TIFF
Date Wed, 29 Jan 2003 16:10:49 GMT
Hi Thomas,

Actually, there's a BUG  :-)  in TIFFImageEncoder.

COMP_PACKBITS is initialised with 32773, but the compression is obtained (line
129 in the source)  from TIFFEncodeParam, where it is initialised with 2.

Therefore,  a switch testing the compression type doesn't work.

There should be consistency between the two definitions. Could you please check
this?

Regards, Felicia





Felicia Ionascu wrote:

> Hi Thomas,
>
> Thomas E Deweese wrote:
>
> > Hmm, can you send (just to me please) or put up on a web site an
> > example file?
>
> I attach the file (it has only 2k, as it is nothing but a header, I guess...)
>
> > FI> The code that I use is below:
> >
> >     Hmm, well I've personally never used the Tiff encoder for
> > Multi-Page or compressed TIFF's (the encoder was generously donated by
> > Sun from JAI).
>
> I searched in JAI forums, the difference is that everybody uses a JAI
> specific class (ImageCodec) to create the encoder, in a package that doesn't
> come with Batik.
> This piece of code is reported to work:
>
> OutputStream out = new FileOutputStream(fileName);
> TIFFEncodeParam param = new TIFFEncodeParam();
> param.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE);
> ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out, param);
> encoder.encode(firstImage);
> out.close();
>
> >     Some other questions, is the output stream some form of seekable
> > stream (like File for instance?).  Is the code running as an
> > application or an applet?
>
> Yes, it's a FileOutputStream. The code runs as an application.
>
> >     Do you get any really helpful messages like:
> >
> > 'TIFFImageEncoder8'?
>
> No, no message at all. Everything is supposed  to be OK.
>
> I wonder if the sample model or the image type have anything to do with
> this...
>
> Felicia
>
> > FI> //NOTES // bufferedImagesList is a Vector containing FormatRed
> > FI> objects of type TYPE_3BYTE_BGR and the sample model
> > FI> PixelInterleavedSampleModel //renderedImage is a FormatRed object
> > FI> of the same type and sample models as the bufferedImagesList
> > FI> objects
> >
> > FI>      TIFFEncodeParam encodeParam = new TIFFEncodeParam();
> >
> > FI>     //this is for the multipage output
> > FI> encodeParam.setExtraImages(bufferedImagesList.iterator());
> >
> > FI>      //set the image resolution to 150 TIFFField[] extras = new
> > FI> TIFFField[2]; extras[0] = new TIFFField(282,
> > FI> TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{(long)150,
> > FI> (long)1},{(long)0 ,(long)0}}); extras[1] = new TIFFField(283,
> > FI> TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{(long)150,
> > FI> (long)1},{(long)0 ,(long)0}}); encodeParam.setExtraFields(extras);
> >
> > FI>     //this should be for the compression
> > FI> encodeParam.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS);
> >
> > FI>     //and now... encode it!  OutputStream outputStream = new
> > FI> FileOutputStream (outputFilename); TIFFImageEncoder encoder = new
> > FI> TIFFImageEncoder (outputStream, encodeParam);
> > FI> encoder.encode(renderedImage); outputStream.close(); outputStream
> > FI> = null; [...]
> >
> > FI> I wonder if it is supposed to work. Did you encounter a similar
> > FI> situation?
> >
> > FI> Thanks a lot in advance, Felicia
> >
>
>   ------------------------------------------------------------------------
>                                   Name: DetailedWithCompanyLogo.tif
>    DetailedWithCompanyLogo.tif    Type: TIFF Image (image/tiff)
>                               Encoding: base64
>
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org

--
------------------------------------------------------------
 Felicia IONASCU                 Océ Print Logic Technologies
 mailto:fgi@ocegr.fr             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: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message