1
0
mirror of https://github.com/ragestudio/comty.git synced 2025-06-19 15:34:16 +00:00
2024-03-05 10:20:36 +00:00

14 lines
397 B
JavaScript
Executable File

export default (image, numChannels) => {
const pixels = image.data
const numPixels = image.width * image.height
const values = new Int32Array(numPixels * numChannels)
for (let i = 0; i < numPixels; i++) {
for (let channel = 0; channel < numChannels; ++channel) {
values[i * numChannels + channel] = pixels[i * 4 + channel]
}
}
return values
}