Q: How is the quality parameter defined when using JPEG2000 compression in jPDFOptimizer?

This is the sample code I am using to compress existing images to JPEG2000 within PDF documents using jPDFOptimizer.

imageoutput.setCompression(ImageOutput.CO_JPEG2000);
imageoutput.setCompressionQuality(0.8f);

The quality setting for JPEG200 compression is used to calculate the data rate (bits per pixel). The range for this value is 0.0 to 1.0 with lower values producing higher compression and lower quality. As a guideline, 0.25 is low quality, 0.5 is medium quality and 0.75 is high quality. If a value higher than the loss-less compression rate is provided, then making a small change in the value will not make a difference. For example, if a quality of 0.5 produces loss-less compression, then anything higher than 0.5 will produce the same results. However using a compression of 0.4 will produce a smaller, lower quality file.

The quality parameter maps the quality setting to compression ratio and then to bits per pixel. We started with a scale from the British Library and tweaked.

The British library compression ratio table:
Compression Ratios – 320, 160, 80, 40, 20, 11.4, 7.1, 4.6, 3.4, 2.8, 2.4
On RGB images, this converts to bits per pixel of: 0.075, 0.15, 0.3, 0.6, 1.2, 2.1, 3.4, 5.2, 7, 8.7, 10

Qoppa’s tweaked compression ration table:
Compression Ratios – 320, 160, 80, 40, 20, 11.4, 7.1, 4.6, 3.4, 2.5, 2
On RGB images, this converts to bits per pixel of: 0.075, 0.15, 0.3, 0.6, 1.2, 2.1, 3.4, 5.2, 7, 9.6, 12