title: PDFBox convert PDF to TIFF. Reduce image size in bytes
body: <p>I'm trying to convert a pdf to a tiff image. I got it working by using pdfbox but the image is too big.</p>
  
  <p>Let's say my PDF size is 224kb => image size=1.4Mb</p>
  
  <p>How can I make the tiff file smaller without losing quality?</p>
  
  <p>Here is some of the code:</p>
  
  <pre><code>TIFFImageWriterSpi tiffspi = new TIFFImageWriterSpi();
  writer = tiffspi.createWriterInstance();
  ImageWriteParam param = writer.getDefaultWriteParam();
  TIFFImageWriteParam param2 = (TIFFImageWriteParam) writer.getDefaultWriteParam();
  param2.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
  
  param2.setCompressionType("LZW");
  param2.setCompressionQuality(1.0f);
  
  writer.setOutput(output);
  writer.write(null,new IIOImage(image,null,null),param2);
  </code></pre>