cdgriffith / puremagic

Pure python implementation of identifying files based off their magic numbers
MIT License
158 stars 34 forks source link

Adding JPEG-XL Support #48

Closed ItsSharples closed 6 months ago

ItsSharples commented 6 months ago

From https://github.com/ImageMagick/jpeg-xl/blob/main/doc/format_overview.md

JPEG-XL Either starts with 0xFF0A for a Raw JPEG-XL Codestream 0x0000000C 4A584C20 0D0A870A for a ISOBMFF-based container

Checking the files at https://jpegxl.info/art/2021-04_jon.html, I can confirm that 0xFF0A is used for Raw Codestreams

NebularNerd commented 6 months ago

I've added a PR to handle these, one small quirk/annoyance is that the raw FF0A header is tiny (I know they want to keep file size down), however, this will lead to confidence issues against .qrp files if the next byte in a raw stream is 00

https://github.com/cdgriffith/puremagic/blob/5cdc4a08a1170c894f4cf338039a113837004042/puremagic/magic_data.json#L1208

cdgriffith commented 6 months ago

Thank you for the info @ItsSharples and PR for it @NebularNerd! Added in https://github.com/cdgriffith/puremagic/releases/tag/1.21

Unfortunately low confidence is just a fact of life with files like this.