Blueforcer / awtrix3

Custom firmware for the Ulanzi Smart Pixel clock or self made awtrix. Getting started is easy as 1-2-3
https://blueforcer.github.io/awtrix3/
Other
1.4k stars 112 forks source link

[BUG] - RGB565 rendering issue #138

Closed jeeftor closed 1 year ago

jeeftor commented 1 year ago

Bug report

Describe the bug

I have this gif:

2316

of a moon with the following colors according to image magic:

root@9b74833e9288:/imgs#  magick identify -verbose 2316.gif | grep '#'
  Alpha: none   #00000000
            12: (0,0,0,0) #00000000 none
             4: (29,29,29,255) #1D1D1DFF srgba(29,29,29,1)
            22: (53,53,53,255) #353535FF srgba(53,53,53,1)
             3: (206,206,206,255) #CECECEFF srgba(206,206,206,1)
            14: (214,214,214,255) #D6D6D6FF grey84
             9: (240,240,240,255) #F0F0F0FF grey94
    0: (0,0,0,0) #00000000 none
    1: (29,29,29,1) #1D1D1DFF srgba(29,29,29,1)
    2: (53,53,53,1) #353535FF srgba(53,53,53,1)
    3: (206,206,206,1) #CECECEFF srgba(206,206,206,1)
    4: (214,214,214,1) #D6D6D6FF grey84
    5: (240,240,240,1) #F0F0F0FF grey94
    6: (0,0,0,1) #000000FF black
    7: (0,0,0,1) #000000FF black

I think I'm probably doing my RGB565 color conversion wrong- however - I've checked it a few times. It appears to not render correctly when I use a source image and a BMP array at the same time.

These colors convert into:

1D1D1D -> 6371 353535 -> 12710 CECECE -> 52857 D6D6D6 -> 54970 F0F0F0 -> 63390

And the main issue is when I pass the following packet:

{   "icon":"2316",
    "text": "",
    "draw":[
        {"db": [22,0,8, 8, 
[
0,      0,      54970,  54970,  12710,  12710,  0,      0,
0,      54970,  54970,  63390,  12710,  12710,  12710,  0,
54970,  54970,  63390,  63390,  6371,   6371,   12710,  12710,
54970,  63390,  52857,  63390,  6371,   12710,  12710,  12710,
54970,  63390,  52857,  63390,  12710,  12710,  12710,  12710,
54970,  54970,  63390,  63390,  12710,  6371,   12710,  12710,
0,      54970,  54970,  52857,  12710,  12710,  12710,  0,
0,      0,      54970,  54970,  12710,  12710,  0,      0]
        ]}]}

Which should be the BMP matrix of the icon I get the following rendering:

IMG_9986

With the icon representation to the left and the BMP rendering to the right ...

I'm not sure if I'm in the wrong color space or something... but I took the .gif and used python to print out the BMP array...

I'm not 100% sure this is a bug and not user error, but if you wanted to investigate hopefully I've given you some information.

(If I could figure out how to get PlatformIO to work on my system I would have debugged the actual pixel rendering of the gif directly)

Additional information

To Reproduce

Steps to reproduce the behavior:

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Logs

(optional) Add relevant logs which could help tackle the problem.

Additional context

Add any other context about the problem here.

Blueforcer commented 1 year ago

12710 is a dark green. image

So i think your converting is wrong. Use this tool to check it. http://www.rinkydinkelectronics.com/calc_rgb565.php

for further discusions i prefer a own forum post in discord. Im happy to help you