Skip to main content

use jai convert jpeg to tiff group3 t.4

2 replies [Last post]
honby1983
Offline
Joined: 2008-09-05

I used jai convert jpeg to tiff for fax.but the fax is not support the tiff image,now I can not find the wrong with my code,please help me.and show your code.my code is

ParameterBlockJAI loadPB = new ParameterBlockJAI("fileload");
loadPB.setParameter("filename","D:/myDoc.jpg");
PlanarImage s = JAI.create("fileload", loadPB);
Image img = s.getAsBufferedImage();
RenderedOp source = JAI.create("AWTImage",img );
source = JAI.create("Invert", source, null);
BufferedImage image = source.getAsBufferedImage();
BufferedImage outputImage=new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_BYTE_BINARY);
outputImage.createGraphics().drawImage(image, 0, 0, null);
TIFFEncodeParam param = new TIFFEncodeParam();
param.setCompression(TIFFEncodeParam.COMPRESSION_GROUP3_2D);
File of = new File("D:/9.TIF");
OutputStream stream = new FileOutputStream(of);
TIFFImageEncoder encoder = (TIFFImageEncoder) TIFFCodec.createImageEncoder("tiff", stream, param);
encoder.encode(outputImage);

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
honby1983
Offline
Joined: 2008-09-05

I had solved the problem.

aspire_2009
Offline
Joined: 2009-09-10

How did you solve the problem? What was incorrect in your code?