-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Detect SOF55 marker to distinguish JPEG-LS from baseline JPEG #506
Comments
It may also be a good idea to check for |
Sounds good to me, why don't you create a PR? |
Small reminder @hackermd |
not sure this is required, afaict neither jpeg-ls nor spiff have a different file extension (or even mimetype) |
It seems to me that they do have a dedicated registered MIME-type: https://www.iana.org/assignments/media-types/image/jls Other references: |
Looking to some jls fixtures found here, some of them have a string So I am not entirely sure how to detect JPEG-LS yet. |
I found this information: JPEG Lossless Compression (ISO/IEC 14495), File type signifiers and format identifiers. Which describes the SOF55 maker, which is actually encoded as |
The library currently checks the first three bytes of the file (
0xFF
,0xD8
, and0xFF
) to determine whether it is a JPEG file:file-type/core.js
Lines 154 to 159 in bb4f822
However, to distinguish between baseline JPEG and JPEG-LS the forth byte should also be checked. It it is
0xF7
("SOF55" or "JPG7" segment), then the file is a JPEG-LS rather than JPEG file andimage/jls
should be returned instead ofimage/jpeg
.The text was updated successfully, but these errors were encountered: