java - is there any other way of converting tiff into jpg without using JAI or JAIImageIO -
I'm not able to add jai libraries in jdk, I've already set it on the right position everywhere. I need to read the TIFF image but it is not working so I tried to convert the TIFF file to JPEG. But still the same error is happening. Classpath set everything is fine. Compiling the code I found on Stackflow:
import java.io.File; Import java.io.FileOutputStream; Import java.io.IOException; Import java.awt.image.RenderedImage; Import com.sun.media.jai.codecimpl.JPEGCodec; Import com.sun.media.jai.codecimpl *; Import com.sun.media.jai.codecimpl.JPEGImageEncoder; Import com.sun.media.jai.codec.SeekableStream; Import com.sun.media.jai.codec.FileSeekableStream; Import com.sun.media.jai.codec.TIFFDecodeParam; Import com.sun.media.jai.codec.ImageDecoder; Import com.sun.media.jai.codec.ImageCodec; Import com.sun.media.jai.codec *; Public class TiffUtils {Public Static Zero TiffToJpg (String TIFF, String Output) throws IOException {file tiffFile = new file (TIFF); SeekableStream s = New FileSeekableStream (tiffFile); TIFFDecodeParam param = Faucet; ImageDecoder dec = ImageCodec.createImageDecoder ("Tiffin", S, Ultimate); Rated image op = dec.decodeAsRenderedImage (0); FileOutputStream fos = New FileOutputStream (Output); JPEGEncodeParam jpgparam = New JPEGEncodeParam (); Jpgparam.setQuality (67); Image Encoder N = ImageCode. Cutte Image Encoder ("JPEG", Foss, JPPPRAM); En.encode (op); Fos.flush (); Fos.close ();} Public Static Zero Main (string [] args) Exception {TiffUtils.TiffToJpg ("C: \\ User \\ JavaPrg \\ Input \\ def.tif", "C: \\ user \ \" JavaPrg \\ input \\ test.jpg "); }}
Time of running AR I am getting NoClassDefFound error for seekeableStream, so now I'm not expanding JDK, I do not want to use JAI and JEimizeo eyepiece
You must see it installed.
Make sure you have installed it correctly.
Comments
Post a Comment