How to darken image using x-window lib in linux

224 Views Asked by At

I am going to darken image using x lib in Ubuntu. Here is my code.

XImage* getCorrectedImage(Pixmap p){
   int buflen, i;
   XImage* img = XGetImage(g_display, p, 0, 0, g_width, g_height,    AllPlanes, ZPixmap);
   buflen = img->width * img->height * img->bitmap_pad / 8;
   for(i = 0; i < buflen; i++){
      img->data[i] /= 2;
   }
}

And the result image is like this:

Image

1

There are 1 best solutions below

1
On

It is problem in color mode. it is not 24bit color mode you have to use 16bit color mode