How to convert binary JP2 (JPEG2000) byte string from buffer into an image?

616 views Asked by At

I have string output from buffer and I want to convert it into the image. I think it's a JPEG2000 format (\x00\x00\x00\x0cjP---). Can you please help me how to do it in Python 3?

My string looks like:

b'\x00\x00\x00\x0cjP \r\n\x87\n\x00\x00\x00\x14ftypjp2 \x00\x00\x00\x00jp2 \x00\x00\x00-jp2h\x00\x00\x00\x16ihdr\x00\x00\x03\xe0\x00\x00\x01@\x00\x01\x07\x07\x00\x00\x00\x00\x00\x0fcolr\x01\x00\x00\x00\x00\x00\x11\x00\x00\x00\x00jp2c\xffO\xffQ\x00)\x00\x00\x00\x00\x01@\x00\x00\x03\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01@\x00\x00\x03\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x07\x01\x01\xffR\x00\x0c\x00\x00\x00\x01\x00\x05\x04\x04\x00\x01\xff\\\x00\x13@@HHPHHPHHPHHPHHP\xff\x90\x00\n\x00\x00\x00\x00\x00\x00\x00\x01\xff\x93\xcf\xb2\xc6\x11PTZ\x10N>\xe9\xe5/|\xeaG\xea\xb5\xd5\xd1\x8d\xd5\xbb\x11\\h\xaf \x13\xd4\x9d\x8c\xb60)\xd9>\xab\xa8\xef\xdcE\x07\xd9\xf5\xcc#\xcc\x8e\x07!------------------------'

0

There are 0 answers