[Image-SIG] problem in converting pixel data to image file
fredrik at pythonware.com
Wed Aug 20 08:09:54 CEST 2008
Ashish Sethi wrote:
> But the thing is I was under the impression that in a ppm image the
> maximum or the min color value that any of the R,G and B components
> can take...i.e. if instead of 255 in the file below, if I give 16 then
> automatically it would imply my color space has changed to RGB 4:4:4
> as all the color components now would be in the range 0-16 (i.e 4 bit
> binary...and let me clarify...
4-bit binary can hold 0-15 per component, not 0-16.
4-bit is also a measurement of the number of bits required to store the
data on file; a text file that uses 9 bytes per pixel isn't the same
thing as a 4-bit binary file. A PPM text file is not a 4-bit file.
Since you insist on creating 4-bit text files, I'm beginning to suspect
that you're confusing internal storage with external storage.
i am repeatedly talking about binary
> from time to time as I use the color information in binary to
> clip/zero pad them to change the color space from rgb888 to rgb444 or
> rgb121212.That is it, not that i wish to save my files in binary
> format. After doing the above manipulation i convert them back to
> decimal nos. and save them to the ppm files.)
who's going to use those PPM files?
> Also, is it required to register this file as an image file or
> something, coz I have plenty of such ppm files in my system which pil
> doesnt recognise as image files. And the ones that it does recognize
> as image files have garbage data (apart from the header part) when
> opened in a text editor.
that "garbage" is binary data and contains the image data. are you
telling me that you haven't seen binary data before?
I'm beginning to feel that this leads nowhere at all; if you want us to
be able to help, please specify
1) what kind of images you plan to convert
2) what the intended use for the "4-bit" text files is
3) what application you're planning to use for the next step (that is,
who's going to read the 4-bit files?)
More information about the Image-SIG