Brooooooklyn / Image

Image processing library.

Home Page:https://image.napi.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: `BUFFER_TOO_SMALL` when using `pngQuantize` to compress small file

Asuka109 opened this issue · comments

I'm using @napi-rs/image in my project to compress images, and I ran into a bug when trying to compress PNG images with pngquant. When I try to compress very small PNG images, the program crashes. I also tried using imagemin-pngquant and didn't encounter this issue, so I suspect it might be related to the implementation of @napi-rs/image.

You can reproduce this problem by following these steps:

$ git clone https://github.com/Asuka109/napi-rs-image-sample.git
$ cd napi-rs-image-sample
$ pnpm i
$ node transform.mjs
node:internal/process/esm_loader:97
    internalBinding('errors').triggerUncaughtException(
                              ^

[Error: Create image failed BUFFER_TOO_SMALL] { code: 'GenericFailure' }

Is this a known issue, or is there something I can do to fix it?

Thank you for your time.