Description
System Information
OpenCV version: 4.12.0-dev
Detailed description
The imreadanimation
function currently fails to properly read specific 16-bit APNG files, including those with 2 channels (grayscale + alpha). Sample images for testing can be found in the APNGKit repository:
033.png
034.png
035.png
A possible solution could be to read 2-channel APNG images as 4-channel images, similar to how imread (as far as I know) processes 2-channel standard PNGs as 4-channel images.
Additionally, the imwriteanimation
function currently converts 16-bit frames to 8-bit before saving. Would it be feasible to support saving 16-bit APNGs if there is a real need for it? (I did not find any 16-bit APNG files except for the mentioned test files.)
I am planning to work on this issue, and any feedback would be helpful.
Steps to reproduce
import cv2 as cv
import numpy as np
animation = cv.Animation()
filename = "034.png"
success, animation = cv.imreadanimation(filename)
cv.imshow("Frame", animation.frames[0])
cv.waitKey()
also take a look on related test code
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)