Possible To Change An Image Color Palette Using Javascript?
I've seen some questions about this here already but none of them provide a good answer. What I need is a javascript (or perhaps some kind of a plugin using PHP/Apache) that can fi
Solution 1:
Yes, it can be done using javascript, by following these steps :
- load the image into a canvas
- get the imagedata (which is an array of rgba values for each pixel)
- loop through the array and convert the rgba values to hex values
- convert the resulting color to the nearest color in the pallette
- convert the new colors back to rgba values
- restore the new imagedata array to the canvas
Post a Comment for "Possible To Change An Image Color Palette Using Javascript?"