Jump to content

Possible To Read Pixel Colors In A PNG?


JeZxLee
 Share

Recommended Posts

Hi,

I am starting the playing game screen on Monday...

I have an interesting issue now with porting the SDL2/C++ logic core to PixiJSv4/JS:
I need to read individual pixel colors in PNG sprites for both the maps and the ghost return home A.I.
Look below to understand...

Is there a method in PixiJSv4 to read individual pixel colors in PNG sprites?
Let me know, thanks!

JeZxLee

PixiHowToReadPNGPixels-01.png

Link to comment
Share on other sites

If you just need to read the pixels of an image, use the canvas 2D APIs. Just create a canvas, draw the image, read with getImageData().

If you need to read pixel values of a rendered scene, use the renderer.plugins.extract.* API since reading pixels is a bit complex in WebGL (by comparison).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...