Automattic / Automattic/photon-opencv
Unable to load large dimension HEIC file
- Dominant language
- C++
- Stars
- 13
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
The included HEIC image file is valid, but when loaded through Photon OpenCV it results in `Unable to decode image` being returned and this error output:
`imcount_('/tmp/pocvPPEBnF'): can't read header or can't find decoder: OpenCV(4.7.0) /home/builder/opencv-4.7.0/modules/imgcodecs/src/loadsave.cpp:1241: error: (-215:Assertion failed) m_decoder in function 'init`
The image has large dimensions (20008x20008), but a small file size (150KB), and this seems to be the problem. Ideally we can either load the image and query the dimensions in order to report it as being too large, or have an error returned that indicates the dimensions are too large.
```php
$photon = new Photon_OpenCV();
try {
$photon->readimage( 'invalid.heic' );
} catch ( Exception $e ) {
print_r($e);
}
```
Also, if the dimensions are a problem it would be useful to know what is supported.
[invalid.heic.zip](https://github.com/user-attachments/files/21791390/invalid.heic.zip)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the failure with invalid.heic through the readimage call shown in the issue, then trace how Photon OpenCV handles the OpenCV decoder error. Done means the large-dimension case produces a useful size-related error or clearly reports supported dimensions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- opencv, php
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100