I’m loading an image from the web for my poster, but I want to add a test in case the image doesn’t load properly, in which case I will load an image from the package. I have no issue loading from the web, but loading from the package doesn’t work.
Function init()
m.BackgroundArt = m.top.findNode("BackgroundArt")
m.BackgroundArt.observeField("loadStatus", "posterLoadStatus")
m.BackgroundArt.uri = "https://imagewillfail.com"
End Function
Function posterLoadStatus(event as Object)
loadStatus = event.getData()
if loadStatus = "failed"
print m.BackgroundArt.uri
print "poster1 failed to load"
m.BackgroundArt.uri = "pkg:/images/bg.jpg"
end if
End Function
The result of this is
https://imagewillfail.com
poster1 failed to load
pkg:/images/bg.jpg
poster1 failed to load
I’m really at a loss for ideas, the image is definitely in the zip, but for some reason it just won’t load.
EDIT: The issue is that I edited my images in gimp which has the “progressive” option selected by default when exporting jpegs, this option is apparently not supported by roku.
@joetesta that’s a good idea, I went and did that and the pkg image does not work. The image file is definitely in the zip, and as far as I know that package uri that I posted is correct, so I’m not really sure what to do with this information haha
There are a couple reasons that images will fail to work, one is interlacing.
Like @cocotower suggests try replacing that image with some other existing .png file that you know works, maybe from an example app. If it does appear, the problem is your image file. If it does not appear, the problem is something with your folder or view structure or perhaps a typo - anything in debug output?
Thanks for the help, I tried using my splash screen images, which also didn’t work, but because of your comments I grabbed a file from one of the example projects on github and that worked. So I’m guessing you were spot on with interlacing being the issue
You mean a progressive JPEG? I’ve never heard of an interlaced JPEG. Interlaced, GIF yes. So far all of my JPEG images work fine. I typically use the old LVIEW editor for all my work but sometimes make a JPEG using paint.net. Never had an issue, as I choose 95% or higher quality and standard compression.
tbh I am not a graphics person but I have seen more than one time that a jpg image did not appear on some models (Roku3 especially) of Rokus and the graphics designers had to produce a new version, that to the naked eye appears the same, but to the roku makes all the difference.