diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 943d9e9452a..eceac61ddb6 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -216,7 +216,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user, colorspace = clip->colorspace_settings.name; } - loadflag = IB_rect | IB_multilayer; + loadflag = IB_rect | IB_multilayer | IB_alphamode_detect; /* read ibuf */ ibuf = IMB_loadiffname(name, loadflag, colorspace); diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 00bc78ee488..4d47d883444 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -75,6 +75,8 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co if (type->load) { ibuf = type->load(mem, size, flags, effective_colorspace); if (ibuf) { + int alpha_flags; + if (colorspace) { if (ibuf->rect) { /* byte buffer is never internally converted to some standard space, @@ -86,11 +88,16 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co BLI_strncpy(colorspace, effective_colorspace, IM_MAX_SPACE); } + if (flags & IB_alphamode_detect) + alpha_flags = ibuf->flags & IB_alphamode_premul; + else + alpha_flags = flags & IB_alphamode_premul; + if (flags & IB_ignore_alpha) { IMB_rectfill_alpha(ibuf, 1.0f); } else { - if (flags & IB_alphamode_premul) { + if (alpha_flags & IB_alphamode_premul) { if (ibuf->rect) { IMB_unpremultiply_alpha(ibuf); }