Open agillis opened 1 month ago
Please do so.
This a PNG with a transparent background using the use_transparency: true
This is the same image with a white background and use_transparency: omitted
As you can see the text fields are fine in both images but the text from the ESPhome logo has no anti-aliasing when use_transparency: true is uesd
Is there a reason I need to use RGB565 as the image type when I load an SVG? I tried RGB24 and RGBA but I get "no data" When I load my image. This may be part of the issue.
In lvgl, that's the only format currently supported. As a workaround, you should simply convert the file manually on your PC and use it as PNG.
I tried that and it still has the same problem. The only way I can get it to work it no set the background of the PNG to the same color as the object background. Any time I use a transparent PNG it seems to remove all the anti-aliasing pixels.
I have tried converting the images to different formats 8-bit 16-bit, etc. Maybe we can come up with a command for ImageMagick that will work?
At some point Clyde will fix the issue with the RGBA image type in the LVGL code. That will resolve this issue.
Just my 2 cts as the original implementer of the "use_transparency" option: In ESPHome, transparency is handled as a binary flag for each pixel: either the pixel is transparent and thus won't be drawn, or it is not transparent, and will be normally drawn.
When compiling the image into the firmware, the python pillow image transformation functions is being used. That code tries to get the transparency information from the original image and IIRC uses a threshold (alpha value > 127) to decide whether to make the pixel transparent or not. My assumption is that the anti aliasing is making use of intermediate alpha values, and they get lost when using a hard threshold as is the case.
RGBA should work better, as you mentioned
RGBA is probably the final solution but at the moment converting True Type Fonts to images using pillow seems to work fine. I don't know enough about the ESPHome code to know how it converters fonts to images but if it could do the same with svg files this problem would be resolved.
The problem
There seems to be an issue with the use_transparency: command. This seems to remove the anti-aliasing from the image.
This is my code