zigbee2mqtt-frontend icon indicating copy to clipboard operation
zigbee2mqtt-frontend copied to clipboard

Device Images Transparency

Open Anjerlaan opened this issue 3 years ago • 27 comments

Is your feature request related to a problem? Please describe. Nice Web Front End! I have some feedback which may enhance the user experience of the Web Front End UI

Describe the enhancement you'd like

  1. Is it possible to make the Device Pictures transparent PNG, instead of white BG? I know there are of course tonnes of images to convert, but maybe image software like photoshop can convert it in batch mode? This way they have more contrast in the Dark Theme mode (see example picture below)

image

  1. Why does the (top) menu item "Zigbee2mqtt", point to the same page as the Devices link? Is it an idea to use this menu item to link to the Z2M page (https://www.zigbee2mqtt.io) or Github page? This way in case of questions or bugs, users can go straight away to the Z2M support/github pages Maybe this link is already somewhere in the Web Front End, but I didn't find it yet And add a picture like

image

Or your own created Web Front End logo

Anjerlaan avatar Jan 22 '22 10:01 Anjerlaan

Hi

  1. Feel free to crop all images and submit a PR
  2. No, this is intentional

nurikk avatar Jan 22 '22 17:01 nurikk

  1. As i Know, the pictures are comming from zigbee2mqtt.io. I tried to convert these pictures to png, but it was rejected by koenkk. In zigbee2mqtt.io only *.jpg with 150x150px are allowed.

Burki24 avatar Jan 25 '22 04:01 Burki24

Images with transparent background is a good idea and better looking, though as Burki24 said, the images are from zigbee2mqtt.io. Maybe there should be a separate repo with images that later can med merged with zigbee2mqtt.io? @Koenkk needs to take a decision I think. I am willing to help with the cropping! :)

YellowNest avatar Jan 28 '22 09:01 YellowNest

Most images come from https://github.com/Koenkk/zigbee2mqtt.io/tree/master/public/images/devices indeed (+- 1800 images).

I'm not sure if making all background transparent is a good idea, it will be hard to see black devices when using the black theme (e.g. https://www.zigbee2mqtt.io/devices/GL-C-008P.html)

Koenkk avatar Jan 28 '22 15:01 Koenkk

Most images come from https://github.com/Koenkk/zigbee2mqtt.io/tree/master/public/images/devices indeed (+- 1800 images).

I'm not sure if making all background transparent is a good idea, it will be hard to see black devices when using the black theme (e.g. https://www.zigbee2mqtt.io/devices/GL-C-008P.html)

There for you need 2 sets of images...for the dark and light theme...in the css you can switch the set

Anjerlaan avatar Jan 28 '22 16:01 Anjerlaan

Most images come from https://github.com/Koenkk/zigbee2mqtt.io/tree/master/public/images/devices indeed (+- 1800 images).

I'm not sure if making all background transparent is a good idea, it will be hard to see black devices when using the black theme (e.g. https://www.zigbee2mqtt.io/devices/GL-C-008P.html)

There for you need 2 sets of images...for the dark and light theme...in the css you can switch the set

Oh no not two sets 😬

@Koenkk black devices will be less visible of course, but will it be that bad? I mean white devices do look good on white background? It is possible to put a white shadow around the darker devices but I don't think it's necessary

YellowNest avatar Jan 28 '22 16:01 YellowNest

@T-IOOO

I mean white devices do look good on white background?

Yes, since all products use white backgrounds by default so they are made for that.

I'm willing to experiment with this, but there should definitely be an automated way to do this. Going through 1800+ images isn't feasible.

Koenkk avatar Jan 29 '22 08:01 Koenkk

I think, it will be possible to have black devices on black ground. Also, if they are original placed on white beckground. And also it will be possible to change that within a batch.

But it will be much easier to change from *.jpg to *.png and leave the backgrpund transparent.

imageimage

Burki24 avatar Jan 29 '22 09:01 Burki24

@Koenkk

I'm willing to experiment with this, but there should definitely be an automated way to do this. Going through 1800+ images isn't feasible.

Do you think, it will be possible to change from jpg to png? If so, I will transform all existent pictures to png with transparent background.

Burki24 avatar Jan 29 '22 09:01 Burki24

@Burki24

Do you think, it will be possible to change from jpg to png?

I don't see why that would be a problem

Koenkk avatar Jan 29 '22 09:01 Koenkk

@Koenkk

I don't see why that would be a problem

Great, so I will start to transform all available pictures from jpg to png, erasing the coloured background. Maybe need 2 days for that. If I finished, we can replace the pictures. Is that okay for you?

Burki24 avatar Jan 29 '22 09:01 Burki24

@Burki24 only if there is an automated way to erase the white background. Note that I manually add images for new supported devices in every release (+- 50 images), having to make all background transparent means a lot of additional work. Maybe something like https://clay-atlas.com/us/blog/2020/11/28/python-en-package-pillow-convert-background-transparent/ could do it

Koenkk avatar Jan 29 '22 09:01 Koenkk

@Koenkk I will check that first.

Burki24 avatar Jan 29 '22 09:01 Burki24

batch conversion of .jpg will not be good at all since some of the images are heavily compressed and therefore will leave ugly white artifacts. White devices would also be affected and render them invisible. I find it possible to manually go through 1800+ images and google up better highres images and crop them. Many devices uses same images. Few willing souls will do it! 😊

YellowNest avatar Jan 29 '22 09:01 YellowNest

batch conversion of .jpg will not be good at all since some of the images are heavily compressed and therefore will leave ugly white artifacts. White devices would also be affected and render them invisible. I find it possible to manually go through 1800+ images and google up better highres images and crop them. Many devices uses same images. Few willing souls will do it! 😊

It belongs to the way, how to erase the background. If you make an erase with a smooth border, the border of the device placed in the picture will get an antaliasis effect. What I need to check, if there is a batch converter, able to do it automaticly. Maybe, you're right to change the existant pictures will not be that problem. But for the future, there we have to ad an instruction for all people expanding the converter and devices what form of pictures are allowd (like now: jpg, 150x150px). Something like *.png, 150x150px cleared background.

Burki24 avatar Jan 29 '22 09:01 Burki24

...also same DPI for all images

YellowNest avatar Jan 29 '22 09:01 YellowNest

Eventually color depth, too. That will have an important impact regarding file-size and loading speed.

Burki24 avatar Jan 29 '22 10:01 Burki24

Maybe this tool is suitable?https://imagemagick.org/script/convert.php

Anjerlaan avatar Jan 29 '22 10:01 Anjerlaan

If it possible I would recommend to have higher images resolutions, then we can have nice crisp images even on retina, using @2x

nurikk avatar Jan 29 '22 11:01 nurikk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 31 '22 18:03 stale[bot]

Hello. How did the discussion end? There are many of us who want to have transparent pictures of only 1800 images two people are 900, 5 people are 360. I like the idea of ​​nurikk to increase the resolution. Let's break it down into parts and everyone will do their job. You just need to decide on the size. I think it would be a good idea to switch from JPG to PNG. None of us have 1800 devices, there are so rare ones that 1-2 people have. but there are common types of xiaomi that everyone has. Koenkk can upload new pictures with a non-transparent background but in PNG format and we will redo them gradually, something similar happened with translation into different languages, after scrolling through the pages, untranslated words appeared in the translation tab, and everyone could go in and fix it. When a picture appears without cropping, you can also go in and replace it with a cropped one. this process will probably be long, but gradually all the icons will be replaced. My idea is that if a user has 50 devices and 2 opaque devices, then everyone will want to fix the opaque image for their project and thus help the community. Also, so that there would be no control, you can appoint someone as a moderator so that he revises the picture for compliance with the standard, can correct it and add it completely, or if, for example, they sent 2 versions of pictures of the same device, then choose a better one.

P/S. I think it could be like a master/dev switch. This operation can start hidden with the jpg/png switch, and when ready to switch to general availability

xrust83 avatar Apr 03 '22 18:04 xrust83

I started, drew my devices, PNG, 256x256 https://github.com/xrust83/iconz2m

xrust83 avatar Apr 18 '22 23:04 xrust83

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 18 '22 17:06 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 08 '22 23:09 stale[bot]

Does anyone really need this? the library contains several hundred png images 512*512 pixels. every time an update of zigbee2mqtt is released and new device support is added, I provide illustrations of these pictures. picture names change picture names in zigbee2mqtt only jpg is replaced by png, if you are interested in this topic you can add support for these pictures in frontend zigbee2mqtt. I will continue to monitor the relevance of updates

https://github.com/xrust83/iconz2m

xrust83 avatar Jan 30 '24 09:01 xrust83

Does anyone really need this? the library contains several hundred png images 512*512 pixels. every time an update of zigbee2mqtt is released and new device support is added, I provide illustrations of these pictures. picture names change picture names in zigbee2mqtt only jpg is replaced by png, if you are interested in this topic you can add support for these pictures in frontend zigbee2mqtt. I will continue to monitor the relevance of updates

https://github.com/xrust83/iconz2m

yes mate, we're discussing adoption and would really love to adopt your image database

nurikk avatar Jan 30 '24 09:01 nurikk

Great news, I'm glad my work was needed. I will update it, if everything goes well in the future, help to set up automatic merging of pictures

xrust83 avatar Jan 30 '24 12:01 xrust83