diff --git a/src/webp.imageio/webpinput.cpp b/src/webp.imageio/webpinput.cpp index 09cc08c4cd..bbe35d9822 100644 --- a/src/webp.imageio/webpinput.cpp +++ b/src/webp.imageio/webpinput.cpp @@ -214,8 +214,11 @@ WebpInput::open(const std::string& name, ImageSpec& spec, // Make space for the decoded image m_decoded_image.reset(new uint8_t[m_spec.image_bytes()]); - if (config.get_int_attribute("oiio:UnassociatedAlpha", 0) == 1) + if (config.get_int_attribute("oiio:UnassociatedAlpha", 0) == 1) { m_keep_unassociated_alpha = true; + if (m_spec.alpha_channel != -1) + m_spec.attribute("oiio:UnassociatedAlpha", 1); + } seek_subimage(0, 0); spec = m_spec; diff --git a/testsuite/webp/ref/out-webp1.1.txt b/testsuite/webp/ref/out-webp1.1.txt index f7e0d095de..92ec6d9f0f 100644 --- a/testsuite/webp/ref/out-webp1.1.txt +++ b/testsuite/webp/ref/out-webp1.1.txt @@ -18,3 +18,9 @@ Reading ../oiio-images/webp/4.webp SHA-1: 8F42E3DCCE6FE15146BA06C440C15B7831F60572 channel list: R, G, B oiio:ColorSpace: "srgb_rec709_scene" +Reading rgba.webp +rgba.webp : 64 x 64, 4 channel, uint8 webp + SHA-1: 897256B6709E1A4DA9DABA92B6BDE39CCFCCD8C1 + channel list: R, G, B, A + oiio:ColorSpace: "srgb_rec709_scene" + oiio:UnassociatedAlpha: 1 diff --git a/testsuite/webp/run.py b/testsuite/webp/run.py index a0a5c53510..3e61dd5d81 100755 --- a/testsuite/webp/run.py +++ b/testsuite/webp/run.py @@ -11,3 +11,6 @@ # a lossy format and is not stable under the round trip # command += rw_command (OIIO_TESTSUITE_IMAGEDIR, f, # extraargs='-attrib compression lossless') + +command += oiiotool ("--create 64x64 4 -o rgba.webp") +command += info_command ("rgba.webp", "--iconfig oiio:UnassociatedAlpha 1", safematch=True)