Open zlsa opened 9 years ago
Obviously this is possible with the toBuffer code but a cleaner API would be nice. That said - the API above is a bit limited.
I'd suggest image.eachPixel(callback(err, pixel));
Where the pixel param is an object with xpos, ypos, and color in it. Then returning a color object (as defined in the libaray) would overwrite the data and returning undefined would be the same as rgba(0,0,0,0)
or a pass-through... depending on what you want the api to be.
Promise support is obviously nice.
The way it would be called:
It should be functionally identical to a loop with
getPixel()
andsetPixel()
but could be optimized in the future. I may try and add this myself if I have the time.