I tried putting a jpeg image as an icon in a menubar but it's just showing up as a white square.
(I tried with my avatar here from github for example, results in this behavior:

menu = hs.menubar.new()
local img = hs.image.imageFromURL(url):setSize({h=16, w=16})
menu:setIcon(img)
menu:setTitle('hello world')
i tried dumping the image to a string and it looks ok as a string. but is showing up as a white square in the menu.
I don't think JPG works - try PNG or PDF
Ah that's unfortunate, I'm getting it from a url, so I have no control over it.
I wish I could easily convert it on the fly, but I don't think I want to get into saving it to disk, converting and then loading from disk again.
EDIT: I tried with a local PNG and it also didn't work.
This works for me...
menu = hs.menubar.new()
url = 'https://avatars1.githubusercontent.com/u/1171003?s=88&v=4'
local img = hs.image.imageFromURL(url):setSize({h=16, w=16})
menu:setIcon(img,false)
I used your avatar url for tests...

You need to use setIcon with false, otherwise it would be used as a template, which converts it to b/w for displaying with normal- and darkmode.
@dasmurphy - wow it works, thank you very much!
I think during my tests I noticed that parameter and I tried passing true there but that's what I get for not reading the docs carefully enough, I totally missed that true is the default
Most helpful comment
This works for me...
I used your avatar url for tests...
You need to use
setIconwithfalse, otherwise it would be used as a template, which converts it to b/w for displaying with normal- and darkmode.