jimp-dev / jimp

An image processing library written entirely in JavaScript for Node, with zero external or native dependencies.
http://jimp-dev.github.io/jimp/
MIT License
13.95k stars 762 forks source link

fix: handle uint8array in node #1300

Closed Kikobeats closed 1 month ago

Kikobeats commented 1 month ago

What's Changing and Why

It handles properly when Jimp receives a Uint8array buffer.

Since puppeteer@23, Uint8Array is used instead of of Buffer. This is the default way for serializing a screenshot or pdf:

const buffer = await page.screenshot(opts) // this is a Uint8array now!

I noted Jimp was already handling arrayBuffer → buffer mainly targeting browsers, but now that Node.js is trying to move away from buffer I extended the original implementation to handle these case in Nodeland too.

Additionally, could be nice if Jimp supports native Uint8array manipulation so it doesn't need to turn it into Buffer.

What else might be affected

Nothing else!

Tasks

hipstersmoothie commented 1 month ago

Can you update this?

Kikobeats commented 1 month ago

the file doesn't exist anymore ¯_(ツ)_/¯