1

I'm trying to get pixel data from my X11 instance, I've seen this thread (How do take a screenshot correctly with xlib?) and the double for loop is taking just too long for me (over a million loops, as the system I'm building requires the highest amount of efficiency possible, sitting around for 600 miliseconds is just not an option). Is there no way to just get a raw array of pixels to avoid the for loop? I know the XImage class has a "data" member which is supposed to contain all of the pixels, but the organizational system that it uses is foreign to me. Any help would be greatly appreciated! The best end game here would be for me to just be able to have X11 write directly to /dev/fb0

Community
  • 1
  • 1
ktb92677
  • 407
  • 4
  • 16
  • `XImage->data` is your array of pixels. You need to interpret it according to its format. There is a bajillion examples on the 'net, look them up and learn how to do that. It's not that hard. Writing or reading directly to /dev/fb0 is definitely not what you want to do. You will jump through countless hoops and end up with **exactly** the same array you have in `XImaage->data`. – n. m. could be an AI Nov 02 '14 at 12:14
  • The culprit here actually seems like the method XGetImage, it takes nearly 100MS to get a million pixels, is there a work around? – ktb92677 Nov 03 '14 at 00:38
  • Not really. Check how an existing screenshot program like `xwd` works. If it's also slow, blame your graphics hardware and/or server configuration. – n. m. could be an AI Nov 03 '14 at 03:32

0 Answers0