shmuelzon / home-assistant-floor-plan

Home Assistant Floor Plan Generator Plugin For Sweet Home 3D
MIT License
330 stars 8 forks source link

Reason not to use JPG compression #92

Open MariusSchenkluhn opened 4 days ago

MariusSchenkluhn commented 4 days ago

Question Is there a reason not to convert the exported PNGs to JPGs?

Additional context First of all: Thank you so much for this great plugin! I love the results.

I experienced slow loading times via Nabu Casa after toggeling lights for the first time (not cached yet). My 13 PNG images are ~12 MB. After converting them to JPGs I ended up with 1.4 MB without noticeable differences in quality and, naturally, almost instand loading times. I experience no draw backs so far in CSS mode so I was wandering if I'm missing something. Otherwise, this could be added to the instructions.

shmuelzon commented 4 days ago

Hey, when the project first started the only rendering mode was the room overlay which needed PNGs because of the image transparency that was needed. I tend to agree that with the CSS mode JPEGs might be good enough since the rendered image is noisy anyway (at least for me). PNGs are still a must for RGB lights... Maybe toss can be another option for the user to choose. I'll look into it.

martikaljuve commented 4 days ago

WEBP is another good option, with alpha channel and lossy/lossless options available. Browser support is good, but not sure if there's a maintained Java encoder for it.

I've been manually converting the floorplan PNG-s to WEBP-s with a simple Powershell script (assumes cwebp is available in your PATH):

Get-ChildItem -Filter *.png | ForEach-Object { & 'cwebp' -q 95 $_.FullName -o "$($_.BaseName).webp" }

Results with 2250x1500 renders (13 files): PNG: 39.8MB WEBP: 2.94MB