Skip to content

opj_compress with lossy compression results in strange pixel values #851

Closed
@vroeyt

Description

When calling opj_compress with lossy compression enabled, I got output pixel values that are completely diffferent than the input pixels. I used the following command (in this case lossy compression with ratio 5):

opj_compress -I -r 5 -i test.tif -o test.jp2

For example, the pixel at position (0,0) in the original TIFF image "test.tif" has pixel value 97, while the corresponding pixel in the output jpeg2000 image "test.jp2" has value 62069. Once could expect that the compressed pixel values are slightly different than the original pixel values, but such a huge difference is strange and unexplainable to me.

Even when I specify a lower compression rate (e.g. rate 2), the huge difference in pixel values remains. When I use lossless compression ("opj_compress -i test.tif -o test.jp2"), the result is as expected (output = input). The compression rate I got when using lossless compression is approx. 3,85.

Attached the test files "test.tif" and "test.jp2". I'm using openjpeg-v2.1.1.

testdata.zip

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions