Extracting an icon from a larger image.

If doesn't fit into any other category ....
Post Reply
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 125 times
Been thanked: 132 times

Extracting an icon from a larger image.

Post by AndyGadget »

NOT a feature request as I can't imagine there'd be a widespread need for it, but is there a copy of the image of a connected TFT display in the ESP32's memory and can this be accessed in any meaningful way by PEEKing?

I'm looking for a simple way of extracting the colour values of small sections of a displayed image (8x8 pixels) to allow it to be displayed as an icon on a neopixel matrix. This can be done in a very painstaking way from a PC app by using a colour pick tool in an image editor but 64 'picks' per icon would be somewhat onerous.

Extracting the data from the JPG or BMP file would be another way of doing this, but unravelling those formats is a bit beyond me.
User avatar
cicciocb
Site Admin
Posts: 2060
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: Extracting an icon from a larger image.

Post by cicciocb »

Hi Andy,
First of all, don't be afraid to ask for new features, it may be included in a future update.

What you are talking about is already included in the neoscroll functions via the neoscroll.spritesheet and neoscroll.sprite functions.

Basically you can "load" a "big" image (a spritesheet) and extract only the part you want directly on the neoscroll display.
You can also play with the images creating animations or scrolling images / texts

This video
shows exactly that just using a larger display.
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 125 times
Been thanked: 132 times

Re: Extracting an icon from a larger image.

Post by AndyGadget »

Thanks Francesco.
I was hoping to present a routine doing what I wanted using neoscroll.sprite but haven't got it working yet.
I was aware of neoscroll.spritesheet and neoscroll.sprite but didn't appreciate their full ability.
Once again, you're ahead of the game.
Post Reply