Open jlo62 opened 3 months ago
This issue is known as color banding, and there are two main approaches to solving it: using dithering on the image (which Inkscape currently when it renders a PNG), or displaying the image at higher bit depth (which, to avoid banding either requires a monitor which supports it, or for Sway to do the dithering itself.)
Implementing either option inside Swaybg would require specific SVG processing that the current image loader, GdkPixbuf, does not support. See https://github.com/swaywm/swaybg/issues/60 for another issue that would be solved with a special SVG pathway.
Is this like mixing pixels from one of the color and the other color to make a gradient in a gradient?
So we would need a whole new svg renderer (or a library)?
Is this like mixing pixels from one of the color and the other color to make a gradient in a gradient?
Yes, see https://en.wikipedia.org/wiki/Dither .
So we would need a whole new svg renderer (or a library)?
swaybg would need to explicitly use librsvg; there's an experimental branch mentioned in #60 , mstoeckl/svg-direct which does this, and enabling dithering on top of that would not be too much work. Technically, it isn't a new renderer, because I believe GdkPixbuf uses librsvg itself anyway.
Hi, the gradients in svg files are rendered poorly. A workaround is to render them as png, but then it's size increases drastically (e.g. 10kb to 1.4mb (for 2.2K) or 2.1mb (for 4k) ), and it isn't really editable, so I have to keep the old (svg) copy around.
tip: The closer in you zoom, the worse you can see the difference.
Wallpaper with svg:\![image](https://github.com/swaywm/swaybg/assets/122014753/f6d1d55c-38fc-4f56-9415-d9e85600fa58)
same image, but rendered out as png in inkscape:\![bg](https://github.com/swaywm/swaybg/assets/122014753/18fc12de-e3b3-4555-aa6d-278f7a360556)
the source file (firefox/github(?) also renders it poorly, but not that bad):![bg](https://github.com/swaywm/swaybg/assets/122014753/9d8f5b50-d0c7-4009-9c2f-4d06b6bc1e80)