mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #27551 from sturkmen72:png-improvements
Add enum IMWRITE_PNG_ZLIBBUFFER_SIZE #27551 ### Pull Request Readiness Checklist This patch enables users to set the internal zlib compression buffer size for PNG encoding See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -12,14 +12,15 @@ TEST(Imgcodecs_Png, write_big)
|
||||
{
|
||||
const string root = cvtest::TS::ptr()->get_data_path();
|
||||
const string filename = root + "readwrite/read.png";
|
||||
const string dst_file = cv::tempfile(".png");
|
||||
Mat img;
|
||||
ASSERT_NO_THROW(img = imread(filename));
|
||||
ASSERT_FALSE(img.empty());
|
||||
EXPECT_EQ(13043, img.cols);
|
||||
EXPECT_EQ(13917, img.rows);
|
||||
ASSERT_NO_THROW(imwrite(dst_file, img));
|
||||
EXPECT_EQ(0, remove(dst_file.c_str()));
|
||||
|
||||
vector<uchar> buff;
|
||||
ASSERT_NO_THROW(imencode(".png", img, buff, { IMWRITE_PNG_ZLIBBUFFER_SIZE, INT_MAX }));
|
||||
EXPECT_EQ((size_t)816219, buff.size());
|
||||
}
|
||||
|
||||
TEST(Imgcodecs_Png, encode)
|
||||
|
||||
Reference in New Issue
Block a user