[Image-SIG] How to deal with BGRA color model in PIL?

Laszlo Zsolt Nagy gandalf at designaproduct.biz
Tue Oct 4 16:46:39 CEST 2005

john taylor wrote:

>hi all,
>i have a string of pixel values, which uses the BGRA
>color model, is there an easy way (hopefully the most
>efficient way) to convert it into the RGBA model, so
>that the image can be displayed correctly?
b,g,r,a = original_image.split()
new_image= Image.merge("RGBA", (r,g,b,a))

BTW, there is an almost identical example in the documentation, section 
"Cutting, Pasting and Merging Images / Example: Splitting and merging 
bands" - please read the docs.


More information about the Image-SIG mailing list