2

I'm developing a C++ program that takes an screenshot with Xlib.

First of all I open the display and I get an XImage pointer with XGetImage().

After that I can get all the pixels with XGetPixel(). It returns a decimal value, so we have to convert it to RGB.

Now, the simplest method is save as ".ppm" image. It works fine but something fails:

¿Transparency?

Some pixel's colours are wrong.

The ppm depth is 24 bits, so I think the problem may be transparency but,

¿ Is that the problem ? ¿ How can I get the alpha channel ?

¿ Should I use another library like OpenGL ?

Thanks!

pirobtumen
  • 176
  • 1
  • 8
  • It seems that some windows have different color tables. Can't remember exactly (didn't use/program X11 since many years), but I remember that you can have different types of windows (color model) on the same display... Isn't this the problem? Or http://stackoverflow.com/questions/8249669/how-do-take-a-screenshot-correctly-with-xlib – Jean-Baptiste Yunès Jun 13 '15 at 09:37
  • yeah it was a function fetching semi-transparent pixels cause `xgetimage`s returns undefined values for transparent pixels. did you solve it.? then how – Newtron Malayalam Oct 12 '20 at 13:44

0 Answers0