How to darken image using x-window lib in linux

196 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 answers

1
X zheng On

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