Is it possible to tell the quality level of a JPEG?

You can view compress level using the identify tool in ImageMagick. Download and installation instructions can be found at the official website. After you install it, run the following command from the command line: identify -format ‘%Q’ yourimage.jpg This will return a value from 0 (low quality, small filesize) to 100 (high quality, large filesize). … Read more

Setting jpg compression level with ImageIO in Java

A more succinct way is to get the ImageWriter directly from ImageIO: ImageWriter jpgWriter = ImageIO.getImageWritersByFormatName(“jpg”).next(); ImageWriteParam jpgWriteParam = jpgWriter.getDefaultWriteParam(); jpgWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); jpgWriteParam.setCompressionQuality(0.7f); ImageOutputStream outputStream = createOutputStream(); // For example implementations see below jpgWriter.setOutput(outputStream); IIOImage outputImage = new IIOImage(image, null, null); jpgWriter.write(null, outputImage, jpgWriteParam); jpgWriter.dispose(); The call to ImageWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) is needed in order to explicitly set … Read more