I am trying to compress some binary images i.e. images with bit depth equal to 1. For JPEG-XR encoder I used jxrlib but it is not able to compress the image. I am using specified format bmp. Even with some of the online compressors present I am not able to compress my bmp file to jxr. I have even tried with tiff files.

So because of this I have a double, does JPEG-XR does not support compression of binary images ? If so do I need to make some changes in my compression command. I am using the following command:

JXREncApp -i Image3_3.bmp -o output.jxr -c 1

For the reader's reference I am also attaching how to instructions needed to be given: JXREncApp [options]...

  -i input.bmp/tif/hdr         Input image file name
                               bmp: <=8bpc, BGR
                               tif: >=8bpc, RGB
                               hdr: 24bppRGBE only

  -o output.jxr                Output JPEG XR file name

  -q quality                   [0.0 - 1.0) Default = 1.0, lossless
  or quantization              [1   - 255] Default = 1, lossless

  -c format                    Required to define uncompressed source pixel format
                                0: 24bppBGR
                                1: 1bppBlackWhite
                                2: 8bppGray
                                3: 16bppGray
                                4: 16bppGrayFixedPoint
                                5: 16bppGrayHalf
                                7: 32bppGrayFixedPoint
                                8: 32bppGrayFloat
                                9: 24bppRGB
                               10: 48bppRGB
                               11: 48bppRGBFixedPoint
                               12: 48bppRGBHalf
                               14: 96bppRGBFixedPoint
                               15: 128bppRGBFloat
                               16: 32bppRGBE
                               17: 32bppCMYK
                               18: 64bppCMYK
                               22: 32bppBGRA
                               23: 64bppRGBA
                               24: 64bppRGBAFixedPoint
                               25: 64bppRGBAHalf
                               27: 128bppRGBAFixedPoint
                               28: 128bppRGBAFloat
                               29: 16bppBGR555
                               30: 16bppBGR565
                               31: 32bppBGR101010
                               32: 40bppCMYKA
                               33: 80bppCMYKA
                               34: 32bppBGR

  -d chroma sub-sampling       0: Y-only
                               1: YCoCg 4:2:0
                               2: YCoCg 4:2:2
                               3: YCoCg 4:4:4 (default)
     (if not set is 4:4:4 for quality >= 0.5 or 4:2:0 for quality < 0.5)

  -l overlapping               0: No overlapping
                               1: One level overlapping (default)
                               2: Two level overlapping
     (if not set is One for quality > 0.4 or Two for quality <= 0.4)

  -f                           Turn off frequency order bit stream (to spatial)

  -p                           Turn off progressive mode (to sequential)

  -t                           Display timing information

  -v                           Display verbose encoder information

  -V tile_wd0 [tile_wd1 ... ]  Macro block columns per tile 

  -H tile_ht0 [tile_ht1 ... ]  Macro block rows per tile

  -U num_v_tiles num_h_tiles   Vertical & horizontal tile count for uniform tiling

  -b Black/White               Applies to 1bpp black/white images
                               0: 0 = black (default)
                               1: 0 = white

  -a alpha channel format      Required for any pixel format with an alpha channel
                               2: Planar alpha (default)
                               3: Interleaved alpha
                               Other: Reserved, do not use

  -Q quantization for alpha    [1 - 255] Default = 1, lossless

  -F trimmed flexbits          [0 - 15]  0: no trimming (default)
                                        15: trim all

  -s skip subbands             0: All subbands included (default)
                               1: Skip flexbits
                               2: Skip highpass
                               3: Skip highpass & lowpass (DC only)

Please do let me know what am I doing wrong here.

  • $\begingroup$ The biggest thing would be the lossy vs lossless. Some algorithm that supports Zero Run-Length Encoding might be of value, though Im not sure which do. Others would be using some sort of huffman encoding. $\endgroup$
    – CyberMen
    Commented Mar 4 at 18:01

2 Answers 2


Is it encoded as a true binary format, or as bytes being either 0 or 255?

Do you want lossy or lossless compression? I would try png/gif or zip. Possibly some run-length encoder would do decently.


It can be used. It is not the use case it was optimized for. Just scale the values of your image. Still, there will be only 2 values, so it is a binary image.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.