+function make_imagebox(fname, w, h, bg)
+ local icon = image(fname)
+ local ib = widget { type = 'imagebox' }
+ local i = image.argb32(w, h, nil)
+
+ if not bg then bg = beautiful.bg_normal end
+
+ i:draw_rectangle(0, 0, w, h, true, bg)
+ i:insert(icon, math.floor((w - icon.width) / 2),
+ math.floor((h - icon.height) / 2))
+
+ ib.image = i
+ return ib
+end
+