Read image Pixels

Hello there , Is there any way to get the image Data through the cocos creator methods , or any helpful way to manipulate the image pixels ??

I’ve searched a lot and I didn’t find something helpful … if anyone can help ?

Thanks

Hello,

Are you trying to read the image pixels in web version of the game or native version?

If in web version, you can get the image url from the cc.Texture2D object. Create a new Image object with this url and draw this image on a temporary HTML Canvas. You can then read the image data by calling context.getImageData() method.

If in native mode, unfortunately there is no way to read image data (as far as I know) on the javascript side other than to write a C++ class extension to read the image data. In the same way, you can get the image file name or url and then create an Image object, and then proceed to read the data by calling image->getData() method.

See [Solved] How to get image data in Native?