ImageOptim / libimagequant

Palette quantization library that powers pngquant and other PNG optimizers
https://pngquant.org/lib
Other
780 stars 132 forks source link

Big resolution images crash the library #97

Closed Lymphatus closed 1 year ago

Lymphatus commented 2 years ago

I'm trying to process a quite large PNG (7680 × 4320, ~100Mb) but the library seems to not be able to handle it, panicking with thread 'main' panicked at 'attempt to add with overflow' on src/hist.rs:206:34.

The issue is quite easy to reproduce by running the provided example and just setting

let width = 5000;
let height = 5000;

or anything bigger than that. Crashes all the time on my machine.

Additional info: