diff options
Diffstat (limited to 'source/blender/imbuf/intern/oiio/openimageio_api.cpp')
-rw-r--r-- | source/blender/imbuf/intern/oiio/openimageio_api.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index 9d8c5d50a89..1e8c3c25778 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -163,16 +163,13 @@ static ImBuf *imb_oiio_load_image_float( extern "C" { -int imb_is_a_filepath_photoshop(const char *filename) +bool imb_is_a_photoshop(const unsigned char *mem, size_t size) { - const char *photoshop_extension[] = { - ".psd", - ".pdd", - ".psb", - nullptr, - }; - - return BLI_path_extension_check_array(filename, photoshop_extension); + const unsigned char magic[4] = {'8', 'B', 'P', 'S'}; + if (size < sizeof(magic)) { + return false; + } + return memcmp(magic, mem, sizeof(magic)) == 0; } int imb_save_photoshop(struct ImBuf *ibuf, const char * /*name*/, int flags) @@ -198,7 +195,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac const bool is_colorspace_manually_set = (colorspace[0] != '\0'); /* load image from file through OIIO */ - if (imb_is_a_filepath_photoshop(filename) == 0) { + if (IMB_ispic_type_matches(filename, IMB_FTYPE_PSD) == 0) { return nullptr; } |