在java中将jpg图像转换为tiff图像格式

时间:2015-01-29 06:28:05

标签: java

我想读取JPEG图像并获取tiff字节[]或将其写入tiff文件。

FileSeekableStream stream = new FileSeekableStream("C:\\Users\\chathurangarw\\Desktop\\download.tiff");
    TIFFDecodeParam decodeParam = new TIFFDecodeParam();
    decodeParam.setDecodePaletteAsShorts(true);
    ParameterBlock params = new ParameterBlock();
    params.add(stream);
    RenderedOp image1 = JAI.create("tiff", params);
    BufferedImage img = image1.getAsBufferedImage();
    ImageIO.write(img, "TIFF", new File("C:\\Users\\chathurangarw\\Desktop\\asdf.tif"));

0 个答案:

没有答案