Dynamic icons: svg or also png should work? Problem

just trying to use dynamic icons for an alarm-switch,

The icon sizes are 32x32px

I create:

and put them in the folder: ./icons/classic

But they are not used.
Are only svg files supported for dynamic icons?

I try the icons in the item-files <m_alarm> and in the sitemap (… icon=“m_alarm”). Should it works on both or only in items-file?

Or any mistake on my side?

Try to convert png to svg with Gimp, but this seems no so easy (no direct “export” function).
PS: Is there a special reason that openHAB supports svg and no jpg’s? png is also OK (when works with dynamic icons). And shure, jpg is compressed and have not always the best quality …

SVGs are vector graphics files defined by text (Almost human readable)
For example this in my sunrise:

<?xml version="1.0" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg width="495" height="495" version="1.1" xmlns="http://www.w3.org/2000/svg">
	<path d="M493.5,330.75H1.5c-0.829,0-1.5-0.671-1.5-1.5s0.671-1.5,1.5-1.5h492c0.829,0,1.5,0.671,1.5,1.5
		S494.329,330.75,493.5,330.75z" stroke="#ff7b00" stroke-width="20"/>
	<path d="M246,269.25c-0.829,0-1.5-0.671-1.5-1.5v-102c0-0.829,0.671-1.5,1.5-1.5s1.5,0.671,1.5,1.5v102
			C247.5,268.579,246.829,269.25,246,269.25z" stroke="#ff7b00" stroke-width="20"/>
	<path d="M141.518,266.985c-0.384,0-0.768-0.146-1.061-0.439l-72.07-72.07c-0.586-0.585-0.586-1.536,0-2.121
			" stroke="#ff7b00" stroke-width="20"/>
	<path d="M360.655,266.985c-0.384,0-0.768-0.146-1.061-0.439c-0.586-0.585-0.586-1.536,0-2.121l72.07-72.07
			z" stroke="#ff7b00" stroke-width="20"/>


A PNG file is like a bitmap. Where every pixel is defined.It also add some metadata to the file in text format.
JPG are compressed graphics and not suitable for icon use.

Going back to your issue…
Try naming your icons like this:

Without the _
In the sitemap, it should now be: ...icon-"malarm"

Please note that the sitemaps can use the svg OR the png icons but NOT both on the same sitemap

Thx for this hint, maybe this caused my problem.
Is this (important) information in the docuemented, I post the link I found for dynamic icons.

And, if I use standard icons from oH (like switch, or rollershutter), they are in svg -format, correct?
So I can not use own png-icons anymore in this sitemap?
Are the default oH icons (with several states like battery, signal level, switch, light levels) also available as png, so I can use every time png-files (which are much easier to find and convert) ?


First of all:
The underscore is an allowed character and should not lead to problems.

SVG vs PNG Icons:
You have to choose which icon format you want to use, which can be done by configuration in PaperUi (and at least the Android App has also a setting for this.)
You can find this information in https://www.openhab.org/docs/configuration/items.html#icons

Yes I think they are provided in both formats.


Maybe a provider like https://www.flaticon.com can already help you in finding useful svg icons.
A huge amount is free to use under their terms and there are other providers for sure.

1 Like

I have seen that earlier but now in latest 2.5.1 it seems to be gone ?
Would I need to add as as an “additional parameter” then ?
Is there an equivalent to set it in runtime.cfg ?

You can create a basicui.cfg or classicui.cfg in conf/services, that’s what I did. Can post the syntax this evening.

Thanks. Found it: https://github.com/openhab/openhab-distro/blob/master/features/distro-resources/src/main/resources/services/basicui.cfg

1 Like