Reverse order of bit in repeating seqence of byte string

Scott David Daniels Scott.Daniels at Acm.Org
Mon Jan 5 01:28:06 CET 2009

imageguy wrote:
> On Jan 2, 7:33 pm, John Machin <sjmac... at> 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 ='~/VPython.png')
     >>> r, g, b = p.split()
     >>> q = Image.merge('RGB', [b, r, g])

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