[Image-SIG] problem in converting pixel data to image file

Fredrik Lundh fredrik at pythonware.com
Wed Aug 20 19:37:59 CEST 2008


Ashish Sethi wrote:

> IF there is a file in ppm format like
> 
> P3
> 3 3
> 15
> 0 0 0   10 10 10  2 2 2
> 1 1 1   12 12 12  4 4 4
> 4 4 4   11 11 11  9 9 9
> 
> Then isnt this file in RGB 4:4:4 color space as the maximum value that
> any of the color components can take is 15 (binary 4 bit)

Given that it uses 2-3 bytes per component (16-24 bits), I wouldn't call 
it a 4-bit image.  PPM text files may have a maximum value, but they 
don't have a bit size.  The data in the file will fit in a 4-bit file, 
though.

> What my job is to read a ppm(p3) file in RGB 8:8:8 color space where
> values are in 0-255 range and change these values to 0-16 range as i
> explained earlier.
> This much i have acheived...now i need to create another ppm(p3) image
> using thes new values (a list 3 member tuples).
> Now please explain if their is something wrong in my understanding and
> if not please help me in creating the new ppm file

I posted code for writing PPM text files earlier.

</F>



More information about the Image-SIG mailing list