mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
14 lines
397 B
JavaScript
Executable File
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
|
|
} |