Reverse order of bit in repeating seqence of byte string

Scott David Daniels Scott.Daniels at Acm.Org
Sun Jan 4 19:28:06 EST 2009


imageguy wrote:
> On Jan 2, 7:33 pm, John Machin <sjmac... at lexicon.net> wrote:
>> For some very strange definition of "works"....
> 
> Well that's embarrassing ... you are correct.  I need to convert from
> 'bgr' to 'rgb'

If that is the only issue:
     >>> import Image
     >>> p = Image.open('~/VPython.png')
     >>> r, g, b = p.split()
     >>> q = Image.merge('RGB', [b, r, g])
     >>> q.save('~/VPython1.png')

Should be plenty fast.
Read the PIL docs before rolling your own solutions.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list