-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color chanel swapping for some JPEG2000 pictures #1382
Comments
@nicoinn ,
winfried |
=> Not 100% sure. I used Pillow==8.3.2 and opencv-python==4.5.3.56, both fail.
3-4-5: well, can't say much, I haven't tried that. I'm mainly interested in opening that in Python. If you think the bug is in PIL and OpenCV, I can move there. I just thought that two completely independent implementation having the same issue may be a sign of a problem in the underlying library (?) @ValZapod The image data is raw. We read the chip with our app (svipe.com), locate the photo datastream as per the ICAO standard specs and the dg2img is a direct extraction from the passport bytes for bytes. No conversion involved. I have a few other Belgian passport photos I could share for debugging (my kids), but I'd prefer to not post these publicly here. I can also share the entire datagroup 2 of my passport if you think some of the metadata could help :) |
And in case anyone with the same problem googled his or her way up to here, a workaround this issue is to use wand.image . Open, convert to bitmap, send blob to PIL, done... Just very inelegant. |
I found that both openjpeg 2.1 and 2.4 get installed as dependencies. I suppose each of PIL/OpenCV wants its how version... |
I believe there is a bug in the colour channel interpretation for the photo attached.
dg2img-3f096fe9d00296bc3734ac4f01b5bf60.j2k.zip
I'm trying to open it from Python and it ends up with swapped color channels --- Pillow or OpenCV will give the same result, both use OpenJPEG under the hood.
To be noted that other JPEG2000 photos open correctly, and that this photo open correctly in many other applications (Preview, Safari).
This photo comes from a Belgian passport (stored in the biometric chip), and all Belgian passports I could get access to have the same issue.
In case anyone worries about personal information sharing, this photo is from my passport --- and I hereby grant right to anyone to play with it for the purpose of debugging this issue and nothing else ;)
The text was updated successfully, but these errors were encountered: