diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp index 3941961b5631..3201ddd9a310 100644 --- a/modules/imgcodecs/src/grfmt_png.cpp +++ b/modules/imgcodecs/src/grfmt_png.cpp @@ -508,11 +508,6 @@ bool PngDecoder::readData( Mat& img ) { return false; } - // Asking for blend over with no alpha is invalid. - if (bop == 1 && mat_cur.channels() != 4) - { - return false; - } memcpy(&m_chunkIHDR.p[8], &chunk.p[12], 8); @@ -1654,7 +1649,8 @@ bool PngEncoder::writeanimation(const Animation& animation, const std::vector 2) + cvtColor(tmp, tmp, COLOR_BGRA2RGBA); apngFrame.setMat(tmp); deflateRectOp(apngFrame.getPixels(), x0, y0, w0, h0, bpp, rowbytes, zbuf_size, 0); diff --git a/modules/imgcodecs/test/test_animation.cpp b/modules/imgcodecs/test/test_animation.cpp index 5fead7013567..2d45132ffd82 100644 --- a/modules/imgcodecs/test/test_animation.cpp +++ b/modules/imgcodecs/test/test_animation.cpp @@ -669,14 +669,15 @@ TEST(Imgcodecs_APNG, animation_imread_preview) { // Set the path to the test image directory and filename for loading. const string root = cvtest::TS::ptr()->get_data_path(); - const string filename = root + "readwrite/033.png"; + const string filename = root + "readwrite/034.png"; cv::Mat imread_result; cv::imread(filename, imread_result, cv::IMREAD_UNCHANGED); EXPECT_FALSE(imread_result.empty()); Animation animation; - imreadanimation(filename, animation); + ASSERT_TRUE(imreadanimation(filename, animation)); EXPECT_FALSE(animation.still_image.empty()); + EXPECT_EQ((size_t)2, animation.frames.size()); EXPECT_EQ(0, cv::norm(animation.still_image, imread_result, cv::NORM_INF)); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy