Getting RGB values out of image
Getting RGB values out of image
Hey there! Is there any option on getting RGB values out of an image? I could not find anything. Is this possible in pure python?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Getting RGB values out of image
You'll have to give us more information if we are to help. Please describe the image format.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Getting RGB values out of image
It’s 8x8 PNG. I need to get the RGB value of every pixel in the image.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Getting RGB values out of image
PNG format is quite involved. For a file that small it might be worth using a format conversion tool to copy it to a simpler format such as uncompressed BMP. Getting pixel data from that should be fairly easy.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Getting RGB values out of image
Thank you! I will look into this tomorrow.
Re: Getting RGB values out of image
Any tips on how to convert this? I can only find solutions that involve using Pillow :/pythoncoder wrote: ↑Sun Dec 05, 2021 6:47 pmPNG format is quite involved. For a file that small it might be worth using a format conversion tool to copy it to a simpler format such as uncompressed BMP. Getting pixel data from that should be fairly easy.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Getting RGB values out of image
As usual there are two options. Search for a library someone's already written; failing that, look up the spec for a BMP file and do it yourself.
This isn't something I've investigated in detail, but I do know that uncompressed BMP is one of the simplest graphics formats.
This isn't something I've investigated in detail, but I do know that uncompressed BMP is one of the simplest graphics formats.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.