1 Reply Latest reply: Mar 22, 2010 5:44 AM by 843802 RSS

    How to reduce the size of a jpeg2000 image ?

    843802
      Hi all,

      I use Java ImageIO to :
      - create JPEG images from JPEG2000 images
      - create JPEG2000 images from JPEG images

      The transformation JPEG2000 to JPEG works fine. The transformation JPEG to JPEG2000 works too, but the JPEG2000 images that I get have a size too big.
      => For a JPEG image 640x480 with a size 43 Kb, I get a JPEG2000 image with a size 170 Kb
      => For a JPEG image 800x600 with a size 66 Kb, I get a JPEG2000 image with a size 276 Kb

      I tried to change many parameters in the J2KImageWriteParam object :
      final J2KImageWriteParam paramJ2K = new J2KImageWriteParam();
      paramJ2K.setLossless(false);
      paramJ2K.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
      paramJ2K.setCompressionType("JPEG2000");
      paramJ2K.setCompressionQuality(0.5F);
      paramJ2K.setEncodingRate(Double.MAX_VALUE);
      paramJ2K.setFilter(J2KImageWriteParam.FILTER_53);
      
      //      paramJ2K.setWriteCodeStreamOnly(true);
      //      paramJ2K.setComponentTransformation(true);
      //      paramJ2K.setProgressionType("res"); //Resolution-Layer-Component-Position
      //      paramJ2K.setProgressionType("layer"); //Layer-Resolution-Component-Position
      //      paramJ2K.setProgressionType("res-pos"); //Resolution-Position-Component-Layer
      //      paramJ2K.setProgressionType("pos-comp"); //Position-Component-Resolution-Layer
      //      paramJ2K.setProgressionType("comp-pos"); //Component-Position-Resolution-Layer 
      But, whatever the values, I still have the same size.
      Can someone help me please ?
      Thanx
        • 1. Re: How to reduce the size of a jpeg2000 image ?
          843802
          Hi,
          I found a solution, for those interested :
          I change filter to have this :
          paramJ2K.setFilter(J2KImageWriteParam.FILTER_97);
          So I get a JPEG2000 with very good quality and a size ~40 Kb.
          Nevertheless, whatever the value I set for compression quality and encoding rate, it has no effect on the quality and the size of the JPEG2000 image, I don't know why...