How to convert ZPixMap to BGRA reliably?

Sai Prasanna sai.r.prasanna at
Tue Aug 22 06:09:26 UTC 2017

I thought Zpixmap mapped directly to BGRA. But my assumption didn't turn
out to be correct in some older X versions.

I am using xcb_get_image and xcb_shm_get_image to grab screen pixels. I
used Zpixmap option for image format. In new-ish Xorg versions it works

But in some machines with older Xorg (1.15 and below) , I get discolored,
overlapped data, and it is less than 4 * width * height bytes. If I try to
read with bytes per pixel as 4 , overflow occurs.

Could  this be some environment issue , or is there any other "proper" way
to convert Zpixmap to bgra/rgb formats?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the xorg mailing list