Closed TruePluto closed 2 years ago
Try:
import imagecodecs
with open('lossless.jpg', 'rb') as fh:
encoded = fh.read()
image = imagecodecs.jpegsof3_decode(encoded)
# or
image = imagecodecs.ljpeg_decode(encoded)
It's work perfectly! Thank you very much.
Hi, I have tried the same code for a file with .LJPEG extension (DDSM), however its decompression didn't go well. could you guide me for this?
Can't reproduce using a few random LJPEG files from DDSM.
Please be more specific. Which file? Which codec? What is the traceback, if any?
The codecs are based on 3rd party libraries jpg_0XC3.cpp and liblj92. They are basically unmaintained.
libjpeg is probably the best maintained library for decoding LJPEG. It is GPL licensed and therefore can't be used by imagecodecs. There's a Python wrapper at pylibjpeg.
All software and libraries I tried return the same image data. If you think they are all wrong, try the original software provided by USF at http://www.eng.usf.edu/cvprg/Mammography/software/heathusf_v1.1.0.html.
I want to read some lossless JPEG images with SOF3 via Python , but I can't find any usage!I'll be appricaite if somebody give me a address or some code as a example。