<div>Hey all,</div>
<div>&nbsp;</div>
<div>I am newbie to image processing using python</div>
<div>&nbsp;</div>
<div>I have a problem in converting between different RGB color spaces.I have a jpeg file in rgb mode.</div>
<div>The rgb data by default is in RGB[8:8:8] mode...i.e,&nbsp;8 bits(1 byte) per band(r,g,b).</div>
<div>I need to convert it into RGB[4:4:4] format by getting the rgb information of each pixel in the image </div>
<div>and converting the ascii values obtained for the R,G and B bands into binary form and then clip the least significant 4 bits </div>
<div>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 </div>
<div>to the image file. Untill now, I have been able obtain the pixel information of my image file using :</div>
<div>&gt;<i>&nbsp;&nbsp; &gt;&gt;&gt; im = Image.open(&quot;image.jpg&quot;)<br></i>&gt;<i>&nbsp;&nbsp; &gt;&gt;&gt; pix = im.load()<br></i>&gt;<i>&nbsp;&nbsp; &gt;&gt;&gt; pix[0, 0]<br></i>&gt;<i>&nbsp;&nbsp; (226, 162, 125)<br></i></div>
<div>1.Now, how do i convert this ascii data to binary?</div>
<div>2.how do i mask last 4 bits ( least significant bits )?</div>
<div>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 </div>
<div>binary RGB[8:8:8] data. How do I do this?</div>