openjpeg icon indicating copy to clipboard operation
openjpeg copied to clipboard

can not decompress a missing bytes .j2c file

Open MastXu opened this issue 6 years ago • 6 comments

please help me.

  1. using kadudu to compress 1 image , such as , kdu_compress -i image.jpg -o out.j2c Creversible=yes -rate 0.25 ;
  2. for some reasons , out.j2c may missing some bytes. so i delete a few bytes from bottom of in.j2c .
  3. kadudu can also decompress this image by cmd : kdu_expand -i in.j2c -o out.bmp .
  4. and opj_decompress kdu_expand -i in.j2c -o out.bmp will occur ERROR , like this

`

  • .\opj_decompress.exe -i in.j2c -o out.bmp -W [C] JPWL correction capability activated; expecting 0 components; [INFO] Start to read j2k main header (0); [INFO] Main header has been correctly decoded. [INFO] No decoded area parameters, set the decoded area to the whole image [ERROR] Tile part length size inconsistent with stream length ERROR -> opj_decompress: failed to decode image!`

Thanks.

MastXu avatar May 23 '18 02:05 MastXu

@MastXu ,

it seems that you do not have the time to explain what you do or have done.

2. for some reasons , out.j2c may missing some bytes. so i delete a few bytes from bottom of in.j2c .

in.j2c XOR out.j2c ?

Nevertheless: if you chop off some bytes from a file this file is broken. Which KDU version did you use? winfried

szukw000 avatar May 27 '18 08:05 szukw000

sorry, i check gmail , find this mentioned. thank you for your question. Correct my description .

  1. firstly, compress. using kadudu to compress 1 image , such as , kdu_compress -i image.jpg -o out.j2c Creversible=yes -rate 0.25 ;
  2. then , i delete a few bytes of out.j2c from bottom to up .
  3. kadudu can also decompress this image by cmd : kdu_expand -i out.j2c -o out.bmp. and i can open and use the out.bmp normally;
  4. and opj_decompress -i out.j2c -o out.bmp will occur ERROR , like last description. `.\opj_decompress.exe -i in.j2c -o out.bmp -W [C] JPWL correction capability activated; expecting 0 components; [INFO] Start to read j2k main header (0); [INFO] Main header has been correctly decoded. [INFO] No decoded area parameters, set the decoded area to the whole image [ERROR] Tile part length size inconsistent with stream length ERROR -> opj_decompress: failed to decode image!``

the kadudu version used is Kakadu_V2.2.3.

MastXu avatar Jul 04 '18 09:07 MastXu

@MastXu , removing some bytes from a file means breaking the file. As you know: appending a virus at the end of the file changes the length of the file. So your input file is broken.

Your KDU version is very old. I use

kdu_expand -v
This is Kakadu's "kdu_expand" application.
    Compiled against the Kakadu core system, version v7.6
    Current core system version is v7.6

I suppose v7.6 likewise does reject your input file.

winfried

szukw000 avatar Jul 04 '18 13:07 szukw000

Thank you. I will test with KDU v7.6 .

MastXu avatar Jul 05 '18 02:07 MastXu

OMG, I am so done with Kakadu! 8.0.4 Kakadu has an opposite problem! It has some garbage bytes after end of codestream!! After 0xFFD9 marker! Fixed in 8.0.5.

ValZapod avatar May 11 '22 07:05 ValZapod

@MastXu Please attach out.j2c right here (you can rename to .jpeg). Please not that Kakadu 8.0.5 no longer writes garbage after marker 0xFFD9.

ZaquL avatar May 13 '22 15:05 ZaquL