loading
 
Python and API question
Dave Cohen from United States  [3 posts]
15 year
Has anyone used the get_image function in the API?  I am able to get the image in either binary or RGB triplet, and write it to disk.  I tried to open it in the Python Imaging Library, along with a few other image programs.  None of them are able to recognize the format.

Is the RR RGB file format like the SGI RGB format, as in triplets of 8-bit R,G,B, with no header information?  Does anybody have any python code samples they would be willing to share?

I'm sure that it's something that I'm doing wrong, but any advice would be appreciated.

BTW Steven, the D-LINK DCS-910 wired ethernet camera works great under RR - thanks.
Anonymous 15 year
Dave,

The RGB triplet format that you receive from GetImage is a raw format with no formatting information (i.e. dimensions) whatsoever. Thus if you save that to disk it will not be read by any paint programs.

You have two options here:

1. Tell RR to save the file using the API in some known format (like jpg).

2. Save the raw triplet information in a PPM file which is the very simplist of image file formats. For example you would write

P6
320 240
255

to the file and then after that write all the RGB triplet information that you got back from get_image. Note that 320 240 is the assumed image size ... you may need to change that as needed.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index