Archived

This topic is now archived and is closed to further replies.

Photoshop RAW + Interleaved data format?

This topic is 5376 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could somebody please explain how to read interleaved raw files (from photoshop)? Non-interleaved is very simple and is just RedByte [(width*height)] data block GreenByte[(width*height)] data block BlueByte [(width*height)] data block However, I am not sure of the layout of interleaved raw files. Wotsit did not provide any help, and I was not able to find (with admittedly modest effort ) any articles from google.

Share this post


Link to post
Share on other sites
The interleaved raw format stores its data like so


rgbrgbrgbrgbrgbrgbrgbrgbrgb

as opposed to a planar (non-interleaved) format which stores it like so:

rrrrrrrrrgggggggggbbbbbbbbb

Assuming that you are using 24 bit images (1 byte for each red, green, and blue), each "line" of the file is width * 3 bytes long. You can do something like so:


      
unsigned char Color[3]; //place to store the color values

void ReadPixel(int x, int y, unsigned char * color)
{
//data is an array of bytes read from the raw file

color[0] = data[y * width * 3 + x * 3 + 0];
color[1] = data[y * width * 3 + x * 3 + 1];
color[2] = data[y * width * 3 + x * 3 = 2];
}


Hope that helps.
-Evan

---------------------------
Those who dance are considered insane by those who cannot hear the music.

Focus On: 3-D Models
Evan Pipho (evan@codershq.com)


*EDIT* Oops, bug fix


[edited by - terminate on March 24, 2003 3:03:20 PM]

Share this post


Link to post
Share on other sites