I am trying to convert TIF image to JPG image. For that I am using the following code :
SeekableStream s = new FileSeekableStream(tiffUrl);
TIFFDecodeParam param = null;
ImageDecoder dec = ImageCodec.createImageDecoder(EXT_TIFFX, s, param);
RenderedImage op = dec.decodeAsRenderedImage(0);
FileOutputStream fos = new FileOutputStream(jpgUrl);
JPEGEncodeParam jpgparam = new JPEGEncodeParam();
jpgparam.setQuality(quality);
ImageEncoder en = ImageCodec.createImageEncoder(EXT_JEPGX, fos, jpgparam);
en.encode(op);
fos.flush();
fos.close();
s.close();
Before conversion my image size was approx 92KB and Bit Depth = 1 After conversion my new jpg image size is approx 1573KB and Bit Depth = 24
I need to manage my new image under 100KB. And I suppose this can be done if I control the Bit Depth to 1 itself.
Is there any solution helpful to perform this ?
IMHO you should use Apache Commons Imaging as it is a advanced and complete imaging solution. I use this to write Tiff
images to PDF. There are plenty of examples . Hope this will helps !!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.