Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
EnTerr
Roku Guru

Can Roku generate a JPG or PNG file?

Let me start with the premise of using roGridScreen and wanting to show text within each "poster" for the categories/items. SDPosterUrl/HDPosterUrl properties for each item instead expect URL to an image. And I don't have that image pre-rendered, assume text is dynamic and making round-trip to external server to render it is unavailable.

So i wonder, is there a way to generate images to tmp:/ so they can be referred by posterUrl?
Something like roBitmap and/or roRegion having save() method that can produce a JPG or PNG?!
0 Kudos
52 REPLIES 52
RokuJoel
Binge Watcher

Re: Can Roku generate a JPG or PNG file?

As to referencing local urls:


SDPosterURL="tmp:/myimageSD.png"
HDPosterURL="tmp:/myimageHD.png"

should work.

ifDraw2d (page 56 of Brightscript manual) has a GetByteArray() method which should give you an robytearray which you can write to tmp:/ using ifByteArray functions (see page 49 of Brightscript manual)

I haven't tried this myself, so this is just information use at your own risk.

You might also look at LibRokuDev https://github.com/rokudev/librokudev which has some .PNG manipulation functions.

- Joel
0 Kudos
TheEndless
Channel Surfer

Re: Can Roku generate a JPG or PNG file?

Writing a byte array directly to disk would result in a raw bitmap, if I'm not mistaken. Do the built-in screens support bmp in addition to jpg, png, and gif? I've had a need for this myself, actually, but haven't had the opportunity to test it out, yet.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
RokuJoel
Binge Watcher

Re: Can Roku generate a JPG or PNG file?

Just checked, looks like setbytearray has not yet been implemented, so it would appear that librokudev is the only option, other than pushing the raw data to a server, converting it and downloading again.

- Joel
0 Kudos
EnTerr
Roku Guru

Re: Can Roku generate a JPG or PNG file?

"RokuJoel" wrote:
Just checked, looks like setbytearray has not yet been implemented, so it would appear that librokudev is the only option, other than pushing the raw data to a server, converting it and downloading again.

Thanks for the ideas, Joel -

1. Did you mean getByteArray() from the documentation is not implemented? (And if it's not implemented, how can i even convert text&font to a raw bitmap?!)

2. Can you put a feature request for this to be done? I.e. allow saving image locally in a format which is both easy to implement and roGridScreen&co will feel comfortable as poster (i seem to remember it may take PNG/GIF but will convert to JPG) - or alternatively have a way to provide TEXT as poster blot
0 Kudos
RokuJoel
Binge Watcher

Re: Can Roku generate a JPG or PNG file?

"EnTerr" wrote:

1. Did you mean getByteArray() from the documentation is not implemented? (And if it's not implemented, how can i even convert text&font to a raw bitmap?!)


No, just that there is no (fast) way to reverse the process of converting a byte array to a bitmap... at least that is my understanding.

"EnTerr" wrote:
2. Can you put a feature request for this to be done? I.e. allow saving image locally in a format which is both easy to implement and roGridScreen&co will feel comfortable as poster (i seem to remember it may take PNG/GIF but will convert to JPG) - or alternatively have a way to provide TEXT as poster blot


The request is already in the system, just followed up, the more really useful use-cases for this sort of thing there are, the higher likelihood of it actually happening.

- Joel
0 Kudos
EnTerr
Roku Guru

Re: Can Roku generate a JPG or PNG file?

"RokuJoel" wrote:
No, just that there is no (fast) way to reverse the process of converting a byte array to a bitmap... at least that is my understanding.

Well there is the constructor CreateObject("roBitmap", String filename) that can load files. But this reverse process does not concern me, since it does not relate to my case.

"RokuJoel" wrote:
The request is already in the system, just followed up, the more really useful use-cases for this sort of thing there are, the higher likelihood of it actually happening.

For my case any of the two things will do: a) ability to overlay text on top (or instead) of poster image background or b) ability to save bitmaps to PNG/JPG (or whatever pleases poster screens). In my particular scenario this is to browse file system but i suppose others can chime in with other cases when it was needed.
0 Kudos
RokuJoel
Binge Watcher

Re: Can Roku generate a JPG or PNG file?

Hmm - seems like you could just pop an ImageCanvas on top of your posterscreen and display whatever you want there - text etc.

- Joel
0 Kudos
kbenson
Visitor

Re: Can Roku generate a JPG or PNG file?

"EnTerr" wrote:

"RokuJoel" wrote:
The request is already in the system, just followed up, the more really useful use-cases for this sort of thing there are, the higher likelihood of it actually happening.

For my case any of the two things will do: a) ability to overlay text on top (or instead) of poster image background or b) ability to save bitmaps to PNG/JPG (or whatever pleases poster screens). In my particular scenario this is to browse file system but i suppose others can chime in with other cases when it was needed.


To receive a raw framebuffer from a VNC server fro display as a VNC Client. I've been waiting on this one for quite a while....

Also, librokudev's PNG libs won't work well for this. PNG's require compression, and while the library does allow for arbitrary PNG chunk creation (to some extent), it does not support compression itself. It's main use was in KidPaint to change the pallete indexed color values (separate, non-compressed chunk of the file), thus changing PNG image colors without needing to pack/unpack the image itself.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
TheEndless
Channel Surfer

Re: Can Roku generate a JPG or PNG file?

"RokuJoel" wrote:
Hmm - seems like you could just pop an ImageCanvas on top of your posterscreen and display whatever you want there - text etc.

- Joel

If you put an image canvas on top of a poster screen, then the image canvas will steal all of the events, so you could no longer navigate the poster screen.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.