thispainting= screen.GetByteArray(0, 0, 5, 5)The code the Roku outputs looks like this:
$data ='q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/w==';and the good sample code i have looks like this:
$data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl' //worksSee how one of these things is not like the other?
$data = base64_decode($data);Any ideas would be appreciated. Thanks
$im = imagecreatefromstring($data);
Also, even if the server accepted an RGBA bitmap, the server is doing a base64 decode so you would need to do a base64 encode on the Roku before sending it. That's why your data doesn't look like the sample data.
strx=thispainting.ToBase64String()doing then? Is it not an encode?
$im = imagecreatefromstring($data);expecting jpeg encoded data? Because you can do either imagejpeg(' ') or imagepng(' ') after this to make a file.
KC - So is this php$im = imagecreatefromstring($data);expecting jpeg encoded data? Because you can do either imagejpeg(' ') or imagepng(' ') after this to make a file.
Sorry, I didn't notice the encode. But the $data= line you quoted doesn't look like it was printed on the Roku. That looks like piece of PHP code.Mark
It seems what you really want is a Roku 2D API that gives you PNG or JPEG output, but that is not available.
Is your intent to send a full screen image, at 1280 x 720? Or just a small part of it?
If you are sending a full screen image, without compression it would be pretty big (3.5 MB?).
Either one of you care to make a suggestion on how I might make it work?
Looks like if you had to, on the server you could do $img = imagecreatetruecolor( $w, $h ) to allocate an image buffer,
then walk over all the pixels and set them from the input pixel data using imagesetpixel.
I imagine there may be more efficient approaches though, browsing PHP docs or internet search may provide options.