title: How can I compress images using java?
body: <p>From pagespeed I am getting only image link and possible optimizations in bytes &amp; percentage like,
   Compressing and resizing <a href="https://example.com/%E2%80%A6ts/xyz.jpg?036861" rel="noreferrer">https://example.com/…ts/xyz.jpg?036861</a> could save 212KiB (51% reduction).
   Compressing <a href="https://example.com/%E2%80%A6xyz.png?303584508" rel="noreferrer">https://example.com/…xyz.png?303584508</a> could save 4.4KiB (21% reduction).</p>
  
  <p>For an example I have image of size 300kb and for this image pagespeed is displaying 100kb &amp; 30% of reduction.</p>
  
  <p>This is only for one image but I am sure I will have lots of images for compression.
   so how can I compress image by passing bytes or percentage as a parameter or using anyother calculations in java
   (by using API or image-processing Tool) so,that I can get compressed version of image as suggested by google.</p>
  
  <p>Thanks in advance.</p>