Skip to content
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

"unknown file format" for what appears to be a standard jpg file. #221

Closed
ploum opened this issue Oct 10, 2024 · 5 comments
Closed

"unknown file format" for what appears to be a standard jpg file. #221

ploum opened this issue Oct 10, 2024 · 5 comments
Labels
bug Not working as advertised compatibility Compatibility (e.g. terminal quirks)
Milestone

Comments

@ploum
Copy link

ploum commented Oct 10, 2024

I stumbled across a particular jpg file which seems to not be recognized by Chafa.

$chafa lexamen_plat1-scaled.jpg
chafa: Failed to open 'lexamen_plat1-scaled.jpg': Unknown file format

$file lexamen_plat1-scaled.jpg
lexamen_plat1-scaled.jpg: JPEG image data, progressive, precision 8, 1665x2560, components 4

$apt-cache policy chafa
chafa:
Installé : 1.14.4-1

lexamen_plat1-scaled

@hpjansson
Copy link
Owner

Looks like it's an Adobe CMYK-space JPEG. The decoding fails because libjpeg can't convert from CMYK to RGB. We need to add some code to do this conversion ourselves.

References:
https://github.com/pytorch/vision/pull/7741/files
https://gitlab.gnome.org/GNOME/gegl/-/blob/master/operations/external/jpg-load.c
https://bugzilla.mozilla.org/show_bug.cgi?id=674619

Also, the GEGL and Mozilla references indicate some (or all?) Adobe CMYK images are inverted. We may need to handle markers too - but since there are good references available, it's not a big task.

@hpjansson hpjansson added bug Not working as advertised compatibility Compatibility (e.g. terminal quirks) labels Oct 10, 2024
@hpjansson hpjansson added this to the 1.14.5 milestone Oct 11, 2024
@hpjansson
Copy link
Owner

Always good to see you here, btw. Hope you're doing well!

@ploum
Copy link
Author

ploum commented Oct 11, 2024

Hey HP, yeah, still using chafa 100 times a day in offpunk ;-) But work on coding has been very slow due to my new book coming out. But I hope to make a release soon.

Always a pleasure to discuss with you ;-)

@ploum
Copy link
Author

ploum commented Oct 11, 2024

Wow, already fixed. That was fast!

@hpjansson
Copy link
Owner

I will read the book :-)

hpjansson added a commit that referenced this issue Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as advertised compatibility Compatibility (e.g. terminal quirks)
Projects
None yet
Development

No branches or pull requests

2 participants