-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to save large AVIF image #8
Comments
|
So...I can fix the issue in this plugin. But it appears that libavif has a limit of 16384x16384 (228 pixels). So although encoding your image would no longer fail with this particular error, you still would not be able to encode the image as AVIF. |
Just adding a detail that the specifications don't allow for huge images with AV1.
I do not see further reference to how to achieve a "grid derivation" AVIF image. |
libavif supports image grids...I had been meaning to look into exposing that in the codec. I'll see what I can do. |
That would be amazing~! |
Hello, I find that libavif may support large images, Does that mean that using the avif plugin to convert a large TIFF image to AVIF format is possible? |
pillow-avif-plugin/src/pillow_avif/_avif.c
Line 483 in ac4789d
Hi @fdintino,
I am trying to use avif plugin to convert a large TIFF image to AVIF format. Unfortunately, I got a RuntimeError:
File "/xxx/Python-3.9.4/lib/python3.9/site-packages/pillow_avif/AvifImagePlugin.py", line 240, in _save
enc.add(
RuntimeError: rgb data is incorrect size: 119151 * 49716 (1628743820) != 5923711116
The raw TIFF image is 39717 x 49716 in RGB mode. I have tried to debug the error and find out it may due to an uint32 overflow issue. The width and height of avifRGBImage are defined as uint32_t. In this case 39717 x 49716 is larage than 4,294,967,295, so it generate a overflowed result (1628743820).
if (rgb.rowBytes * rgb.height != size) {
Convert rgb.rowBytes or rgb.height uint64_t during this operation may fix the issue, but I am not sure whether it will cause any issue in the following step.
Hope this analysis will help to fix this error. Thanks!
The text was updated successfully, but these errors were encountered: