mirror of https://github.com/GNOME/gimp.git
Issue #2209: more accurate magic for HEIF files.
Just looking for "ftyp" would also match other ISOBMFF files (.mov or .mp4 files for instance). These are the possible 4-byte "brand" code which can follow "ftyp", as listed by Dirk Farin from libheif. I add the "mif1" brand, as I encountered some files using this magic (even though this should normally not be valid apparently, yet the file loaded fine in GIMP). This is not perfect as the standard allows potentially very big box headers, in which case 8 bytes (the "largesize" slot) may be inserted between "ftyp" and the brand, as I understand it. But this is actually unlikely enough to probably never happen (the compatible brands list would have to be huuuge, as it looks like this is the only extendable part in a ftyp box). So let's assume this just never happens. See also: https://github.com/strukturag/libheif/issues/83
This commit is contained in:
parent
2c6b5c371e
commit
4ad3993eca
|
@ -120,10 +120,19 @@ query (void)
|
|||
gimp_register_load_handler (LOAD_PROC, "heic,heif", "");
|
||||
gimp_register_file_handler_mime (LOAD_PROC, "image/heif");
|
||||
gimp_register_file_handler_uri (LOAD_PROC);
|
||||
/* HEIF is an ISOBMFF format whose "brand" (the value after "ftyp")
|
||||
* can be of various values. I added the "mif1" brand as I saw some
|
||||
* HEIF files with this value, and it loaded fine (though it may not
|
||||
* be valid theoretically, according to libheif developers).
|
||||
* See also: https://gitlab.gnome.org/GNOME/gimp/issues/2209
|
||||
*/
|
||||
gimp_register_magic_load_handler (LOAD_PROC,
|
||||
"heif,heic",
|
||||
"",
|
||||
"4,string,ftyp");
|
||||
"4,string,ftypheic,4,string,ftypheix,"
|
||||
"4,string,ftyphevc,4,string,ftypheim,"
|
||||
"4,string,ftypheis,4,string,ftyphevm,"
|
||||
"4,string,ftyphevs,4,string,ftypmif1");
|
||||
|
||||
gimp_install_procedure (SAVE_PROC,
|
||||
_("Exports HEIF images"),
|
||||
|
|
Loading…
Reference in New Issue