title: Optimize images - Losslessly compress images in Java
body: <p>Having an ecommerce website, We have thousands of product images. On checking pagespeed on google it shows me something like this:</p>
  
  <p><img src="https://i.stack.imgur.com/EmR38.png" alt="enter image description here"></p>
  
  <p>I was wondering, if there is any built in feature in Java or any third party library is available with which we can losslessly compress all the images that we host. Hence we can save few KBs of our customers.</p>
  
  <p>On searching through internet I found few like punnypng and kraken which are paid, hence we do not have heavy image uploaded every month, subscribing to them is not worth. I would prefer any built in feature in Java or any open source third party library.</p>
  
  <p>I came across <strong>JAI</strong>, but not sure about whether it addresses this problem or not. Anyone with hands-on experience with this?</p>
  
  <p>P.S. We are using Java 8</p>