mirror of
https://github.com/opencv/opencv.git
synced 2026-07-26 22:03:04 +04:00
65cb3fd86c
libpng upgrade to 1.6.45 and cICP metadata support for PNG imwrite #27741 ### Pull Request Readiness Checklist resolves #24185 libpng docs: https://www.w3.org/TR/png-3/#cICP-chunk similar code from ffmpeg: https://github.com/FFmpeg/FFmpeg/blob/a700f0f72d1f073e5adcfbb16f4633850b0ef51c/libavcodec/pngenc.c#L452-L456 So issue #24185 can be solved by replacing `cv.imwrite` in user's code to `cv.imwriteWithMetadata`: ```python cv.imwriteWithMetadata("frame.png", frame, [cv.IMAGE_METADATA_CICP], np.array([[9, 18, 0, 1]], np.uint8)) ``` ``` $ exiftool /home/d.kurtaev/opencv_build/frames_pr/image_38.png ExifTool Version Number : 12.76 File Name : image_38.png Directory : /home/d.kurtaev/opencv_build/frames_pr File Size : 3.8 MB File Modification Date/Time : 2025:09:02 20:48:22+03:00 File Access Date/Time : 2025:09:02 20:48:22+03:00 File Inode Change Date/Time : 2025:09:02 20:48:22+03:00 File Permissions : -rw-r--r-- File Type : PNG File Type Extension : png MIME Type : image/png Image Width : 1080 Image Height : 1920 Bit Depth : 8 Color Type : RGB Compression : Deflate/Inflate Filter : Adaptive Interlace : Noninterlaced Color Primaries : BT.2020, BT.2100 Transfer Characteristics : BT.2100 HLG, ARIB STD-B67 Matrix Coefficients : Identity matrix Video Full Range Flag : 1 Image Size : 1080x1920 Megapixels : 2.1 ``` 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 - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake