suda Senior Java EE Develope specialises in Pdf forms , Fonts, application servers and Image manipulation, meditates in spare time.

Fixing bugs in Java JPEG2000

1 min read

As its name suggests this image compression coding system was created in 2000 by Joint Photographic Experts Group Committee. JPEG2000 image compression technique has significant amount of advantages as compared to JPEG. JPEG2000 has better performance when the image is downscaled to lower bit rates.  Up scaling downscaled image barely loses visual pixel display(known as Lossless compression).Core factor for this better performance is ringing artefact signal processing capability of JPEG2000 therefore the box shaped edges displays as curved where it is applicable. Additionally JPEG2000 decomposes the image into a multiple resolution representation in the course of its compression process. So developers can switch into any resolution they desire. By Default JPEG2000 (named as jj2000) is plugged into java’s JAI api . This software module was originally developed by Swiss Federal Institute of Technology-EPFL.

jj2000 uses a complex encoding and decoding algorithm (please refer to StdEntrophyDecoder and classes ) which undergoes several number of wavelet transformation in order to maintain the image quality to top to bottom levels. which works fine in small scaled images but not in large scaled images.

The algorithm is designed in jj2000 is to result high performance in images with a pixel ratio of 2048 x 2048 or less and you may encounter black blotches or fully or partially blanked images if it is compressed using jj2000. This issue is identified in several cases where the image is scanned.

As I mentioned earlier images are wavelet transformed in maximum number of 30 bit planes in jj2000. 30th bit plane is rarely used and used mainly in large images and some black and white small images.  So the transformation is processed in descending order such as 30 ..29 ..28 and so on. If an error occurred in previous bit planes has affects in following bit planes too.  Bit plane thirty can be removed in large images to eliminate black blotches and blank image display, but unfortunately the elimination of bit plane number 30 reduces the contrast level to minimum. [Please note: if you remove the bit plane 30 in small images where pixel rate is below 2024* 2024 you may not see the image at all].

Interestingly the image contrast can be increased explicitly by multiplying Steps by 2.0 in class (i.e: steps = steps * 2.0f ). Eventually you will get a very similar image to the original.

Do we need microscopes to find faults in jj2000 compression?

IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.

suda Senior Java EE Develope specialises in Pdf forms , Fonts, application servers and Image manipulation, meditates in spare time.

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2020. All rights reserved.