esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 35 forks source link

Waveshare E-paper Images rendered as black squares #4226

Closed JeroenTuinstra closed 1 year ago

JeroenTuinstra commented 1 year ago

The problem

Since version 2023.2.3 (not sure it started there, because I only update my firmware when necessary), images are rendered as black squares. These are PNG with a transparency layer. Before they would render correctly.

So the image is loaded as such:

image:
  - file: "images/restafval2.png"
    id: Lrestafvalpic
    type: TRANSPARENT_BINARY

Then it is called upon like such in the display section:

it.image(255, 450, id(Lrestafvalpic));

This generates a black square. This is the actual image used: restafval2 This is the result: IMG_1486

Which version of ESPHome has the issue?

2023.2.3

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

2023.2.3

What platform are you using?

ESP32

Board

Firebeetle32

Component causing the issue

display/it.image

Example YAML snippet

image:
  - file: "images/restafval2.png"
    id: Lrestafvalpic
    type: TRANSPARENT_BINARY

display:
  - platform: waveshare_epaper
    cs_pin: 22
    dc_pin: 21
    busy_pin: 5
    reset_pin: 13
    model: 7.50in-hd-b
    update_interval: never
    reset_duration: 2ms
    rotation: 90°
    id: epaper_display
    lambda: |-
      it.image(255, 450, id(Lrestafvalpic));

Anything in the logs that might be useful for us?

No errors in the log.

Additional information

No response

JeroenTuinstra commented 1 year ago

When replaced by a JPG image it works fine. So it seems that rendering of PNG images is broken.

image:
  - file: "images/restafval2.jpg"
    id: Lrestafvalpic

This the actual JPG picture: restafval2

And the result is: IMG_1487

jdituicha commented 1 year ago

I also have the same problem with an OLED display since the update to v2023.2.4.

guillempages commented 1 year ago

@JeroenTuinstra @jdituicha I was having the same issue, but seems like changing the image type from "TRANSPARENT_BINARY" to "TRANSPARENT_IMAGE" fixes the problem for me (also using PNGs) I still have to test some more, but this looks promising; you might want to check that as well

guillempages commented 1 year ago

This seems to have been introduced by https://github.com/esphome/esphome/pull/4044 @nielsnl68 this should probably have been marked as breaking change ;-)

jdituicha commented 1 year ago

@guillempages tanks you for the references. "TRANSPARENT_BINARY" to "TRANSPARENT_IMAGE" is my solution. : )

guillempages commented 1 year ago

@jdituicha, think of this as a temporary solution/workaround though; once my PR https://github.com/esphome/esphome/pull/4600 gets merged, the TRANSPARENT_IMAGE type will be removed again.