From 23c71a5fab42e22266196a45f1f2ac77e815bcd3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 10 Nov 2020 22:16:29 +1100 Subject: ImBuf: support detecting the file format from in-memory images Add `IMB_ispic_type_from_memory` so we can detect the file format of in-memory images. This removes `is_a_filepath` callback and uses a magic check for photo-shop files that's compatible with OIIO. Even though OIIO doesn't support packed images, we can still use the file magic for detecting the format. This change allows D9500 (a fix for unpacking images), to be implemented without a significant performance penalty, although the actual performance cost would depend heavily on the blend file. Reviewed By: dfelinto, sergey Ref D9517 --- source/blender/imbuf/IMB_imbuf.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/imbuf/IMB_imbuf.h') diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 2f848b5be08..0f9aa7055e7 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -474,6 +474,8 @@ bool IMB_prepare_write_ImBuf(const bool isfloat, struct ImBuf *ibuf); * \attention Defined in util.c */ bool IMB_ispic(const char *name); +bool IMB_ispic_type_matches(const char *name, int filetype); +int IMB_ispic_type_from_memory(const unsigned char *mem, const size_t mem_size); int IMB_ispic_type(const char *name); /** -- cgit v1.2.3