How can I convert a Uint8ClampedArray
(like one used for storing HTML5 canvas image data) to a regular array, in which values won't be constrained to 0
-255
?
You can convert a typed array to a regular array by using Array.prototype.slice
var typedArray = new Uint8ClampedArray([1, 2, 3, 4]);
var normalArray = Array.prototype.slice.call(typedArray);
Also if using ES6 you may be able to use Array.from
instead:
var normalArray = Array.from(typedArray);