Skip to main content

HELP:how to make a Group3 fax tiff?

1 reply [Last post]
magicgo1
Offline
Joined: 2006-05-16

I want create a tiff for Fax but when I use the code,the tiff become black and the compression type is Group2 1d Huffman,what can I do?:
OutputStream out = null;
out = new FileOutputStream("d:\\example3g1d.tif");

TIFFEncodeParam param = new TIFFEncodeParam();
// Set dpi to metadata
TIFFField[] extras = new TIFFField[4];
extras[0] = new TIFFField(282,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{204,(long)1},{(long)0 ,(long)0}});
extras[1] = new TIFFField(283,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{196,(long)1},{(long)0 ,(long)0}});
extras[2] = new TIFFField(262, TIFFField.TIFF_SHORT, 1, (Object) new char[] {1});
extras[3] = new TIFFField(296, TIFFField.TIFF_SHORT, 1, (Object) new char[] {1});

param.setExtraFields(extras);
param.setCompression(TIFFEncodeParam.COMPRESSION_GROUP3_1D );
ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out, param);
encoder.encode((BufferedImage)outimage.get(0));
out.close();

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Brian Burkhalter

The code below is JAI code, not JAI-Image I/O, so the question is addressed on
the other mailing list.

Brian

On Tue, 1 Aug 2006, jai-imageio@javadesktop.org wrote:

> I want create a tiff for Fax but when I use the code,the tiff become black and the compression type is Group2 1d Huffman,what can I do?:
> OutputStream out = null;
> out = new FileOutputStream("d:\\example3g1d.tif");
>
> TIFFEncodeParam param = new TIFFEncodeParam();
> // Set dpi to metadata
> TIFFField[] extras = new TIFFField[4];
> extras[0] = new TIFFField(282,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{204,(long)1},{(long)0 ,(long)0}});
> extras[1] = new TIFFField(283,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{196,(long)1},{(long)0 ,(long)0}});
> extras[2] = new TIFFField(262, TIFFField.TIFF_SHORT, 1, (Object) new char[] {1});
> extras[3] = new TIFFField(296, TIFFField.TIFF_SHORT, 1, (Object) new char[] {1});
>
> param.setExtraFields(extras);
> param.setCompression(TIFFEncodeParam.COMPRESSION_GROUP3_1D );
> ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out, param);
> encoder.encode((BufferedImage)outimage.get(0));
> out.close();
> [Message sent by forum member 'magicgo1' (magicgo1)]
>
> http://forums.java.net/jive/thread.jspa?messageID=138734
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net