Your Digital Media Has Never Looked So Good

 
User avatar
squirreltown
Posts: 732
Joined: Sun Apr 21, 2013 2:20 pm

Re: Mask an image (show only part of an image)?

Tue Sep 26, 2017 9:46 am

jackhand wrote:
How do you save the file in a different folder? I tried to use the "images/" folder but the app crashed.

filesystem.CreateDirectory("tmp:/newdir")
Do it before you call SceneGraph, see what happens.
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Tue Sep 26, 2017 10:29 am

I created the folder. I am able to create a bitmap in the task node. If I log the bitmap variable it returns as "<Component: roBitmap>"

However, if I create the bitmap in the screen code using the same folder, then the bitmap variable returns as "invalid"

What is the method to store a remote folder on the Roku within a task node but then gain access to that file outside of the task node and in the screen code?
 
necrotek
Posts: 10
Joined: Tue Sep 13, 2011 7:49 pm

Re: Mask an image (show only part of an image)?

Tue Sep 26, 2017 5:22 pm

If you are using a task node to retrieve the image file I will assume you are making a Scenegraph app.
roBitmap and roCompositor are not usable in Scenegraph components

Look at using a Poster node https://sdkdocs.roku.com/display/sdkdoc/Poster

Set the uri field to the image path you have created. Do not use the roBitmap it is for roScreen components.
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Wed Sep 27, 2017 7:23 am

I tried to use the the temp image uri that I got from within the task node. But the locally stored image never loads when I set the local uri to the poster. 

Besides, I need to use bitmap in order to use a region of the bitmap so I can use just a portion of the sprite map, so I'm not sure I could a poster if it worked.

So here are the probems.
  • I can't pass a bitmap from a task node within an associative array since associative arrays can only hold certain simple object types
  • I can pass the image path from the task node, but I cannot use that image path to create a bitmap or set the uri of a poster if the code is outside of the task node. Not sure why! 
 
necrotek
Posts: 10
Joined: Tue Sep 13, 2011 7:49 pm

Re: Mask an image (show only part of an image)?

Wed Sep 27, 2017 4:30 pm

First, I would like to establish that you are creating a sceneGraph app. From the code you have posted you seem to be mixing ROKU SDK1 and Scenegraph which don't mix so well. For instance compositor cannot draw to a posternode unless posternode is roScreen. roBitmap, roRegion, and roCompositor  are all to be used with the SDK1 roScreen components and will fail when used with Scenegraph. Before tackling downloading an external file to the temp file, I would suggest looking at the scenegraph poster component demos to make sure that you can access and display image file that is included locally in the package. 

Once you are familiar with displaying images to a scenegraph scene, then you can determine what the problem is with fetching an image remotely. Possible problems 1) there was a problem with the file transfer 2) make sure that the image size is less that 2048x 2048 pixels in either direction  . Larger will cause a a image to be invalid because Roku has a limit on image size (ie.1px x 2049 px will be invalid ). The downloaded file should remain in the temp:/ file system until channel is exited. You can use the filesystem components to verify the file is there.

Then we can work on displaying part of an image. For those that are interested and looking for an answer to your initial question. Create a group as a child of the scene (or parent of your choosing) use  ClippingRect  to the size you would like the partial image to be. Create a poster node as a child of this group and use translation (negative numbers relative to group) of the poster to position the area you would like to display in the window created by ClippingRect. ClippingRect is documented on the "group"  documentation page I referenced earlier.  

There is a way to do it the way you are trying, but it is more complicated than necessary to achieve the results you are looking for.
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Thu Sep 28, 2017 6:38 am

So if I don't have to use bitmap and regions to see part of the image, then perhaps I can can simply load the remote image normally using the poster node.  Perhaps I do not have to save the extenal image to the temp folder if using the ClippingRect method. I'll try and get back to this thread.

thanks!
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Fri Sep 29, 2017 1:41 pm

This worked for me! Thanks @necrotek!

Where does it say what the max height and width are? I've used images slightly bigger than what you described and the images appear. However, at some point the images get too big and the poster does not successfully load the image. So I'd like to know if allowed dimensions are slightly more. Or they are different for different versions of Roku.
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Mon Oct 02, 2017 8:23 am

I cannot find the image max width/height dimension of "2048" anywhere in the documentation:
https://sdkdocs.roku.com/dosearchsite.action?queryString=2048&startIndex=0&where=sdkdoc

Where is 2048 referenced?
 
User avatar
squirreltown
Posts: 732
Joined: Sun Apr 21, 2013 2:20 pm

Re: Mask an image (show only part of an image)?

Mon Oct 02, 2017 10:53 am

jackhand wrote:
I cannot find the image max width/height dimension of "2048" anywhere in the documentation:
https://sdkdocs.roku.com/dosearchsite.action?queryString=2048&startIndex=0&where=sdkdoc

Where is 2048 referenced?

2048 has been the max for a while. https://sdkdocs.roku.com/display/sdkdoc/roBitmap
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Mon Oct 02, 2017 12:01 pm

But is the same 2048x2048 limit on roBitmap also on the Poster node? 
The reason I ask is because I seem to be able to load images into a poster node that are greater than 2048x2048. Do poster nodes have the same 2048x2048 limit?

(On a totally unrelated note, it is curious why the roBitmap page doesn't come up as a search result when I do a search in the developer documentation site for the term "2048" but it does come up when I search for "2048x2048".)
 
User avatar
squirreltown
Posts: 732
Joined: Sun Apr 21, 2013 2:20 pm

Re: Mask an image (show only part of an image)?

Mon Oct 02, 2017 12:24 pm

jackhand wrote:
But is the same 2048x2048 limit on roBitmap also on the Poster node? 
The reason I ask is because I seem to be able to load images into a poster node that are greater than 2048x2048. Do poster nodes have the same 2048x2048 limit?
(On a totally unrelated note, it is curious why the roBitmap page doesn't come up as a search result when I do a search in the developer documentation site for the term "2048" but it does come up when I search for "2048x2048".)

"Seems" well, it either is or it isn't. If you can load something bigger, then the roBitmap docs don't apply. Again , I don't know RSG.
It sure seems like an easy question for Roku* to answer. 
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Tue Oct 03, 2017 6:55 am

How do we ask Roku*?
 
User avatar
squirreltown
Posts: 732
Joined: Sun Apr 21, 2013 2:20 pm

Re: Mask an image (show only part of an image)?

Tue Oct 03, 2017 7:04 am

jackhand wrote:
How do we ask Roku*?

Hope that RokuSomeone reads this.
You might want to get in the habit of not waiting for Roku to answer something, if you can at all figure it out yourself. it will save you time.
 In this case, can't you just load some increasingly bigger graphics, figure out at what size they fail and set your own standard?
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)
 
jackhand
Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Re: Mask an image (show only part of an image)?

Tue Oct 03, 2017 7:32 am

Yes, I can do that. However, I worry the limit is there for under powered Roku devices. 

A slightly larger image loads using my Roku 4, but what about a Roku stick or a TV with built in Roku?  I'm afraid that an image will load in one Roku device but not load in some others.  2048 may be the minimum size that will load for all Roku devices. If there is a new number for posters, then I will update the code to allow for larger images.
 
User avatar
squirreltown
Posts: 732
Joined: Sun Apr 21, 2013 2:20 pm

Re: Mask an image (show only part of an image)?

Tue Oct 03, 2017 8:27 am

jackhand wrote:
A slightly larger image loads using my Roku 4, but what about a Roku stick or a TV with built in Roku?  

Most of the discussions here about which models a dev needs to cover all models usually pick about 3-4 Roku models to develop on, That's the safe way to do it.  Roku is notoriously tight-lipped about hardware on the forums so the only safe way is to figure it yourself. At this point I would start a new thread with the specific question - what is the max graphic size in RSG?
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)

Who is online

Users browsing this forum: No registered users and 7 guests