Hey all, I am newbie to image processing using python
I have a problem in converting between different RGB color spaces.I have a jpeg file in rgb mode. The rgb data by default is in RGB[8:8:8] mode...i.e, 8 bits(1 byte) per band(r,g,b). I need to convert it into RGB[4:4:4] format by getting the rgb information of each pixel in the image and converting the ascii values obtained for the R,G and B bands into binary form and then clip the least significant 4 bits from this binary no. to form a 4 bit binary value and then convert this back to ascii and and save the new information back to the image file. Untill now, I have been able obtain the pixel information of my image file using : >* >>> im = Image.open("image.jpg") *>* >>> pix = im.load() *>* >>> pix[0, 0] *>* (226, 162, 125) * 1.Now, how do i convert this ascii data to binary? 2.how do i mask last 4 bits ( least significant bits )? 3.also, I need to convert the same image to RGB[12:12:12] mode,for which i need to zero pad with 4 zeroes the binary RGB[8:8:8] data. How do I do this?
_______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig