Reading and Writing out TIFF image in Java

后端 未结 2 842
既然无缘
既然无缘 2020-11-27 20:21

I tried the following code to accomplish the task of reading and writing tiff images:

 // Define the source and destination file names.
 String inputFile = /         


        
2条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 20:47

    FileInputStream in = new FileInputStream(imgFullPath);
    FileChannel channel = in.getChannel();
    ByteBuffer buffer = ByteBuffer.allocate((int)channel.size());
    channel.read(buffer);
    tiffEncodedImg = Base64.encode(buffer.array()); 
    

    Use this contents(i.e value of "tiffEncodedImg") as src value of img tag in HTML

提交回复
热议问题