n windows I used GDI+ to capture a region of the screen. Is there something similar for linux? I want to do

ScreenCapture(Top, Left, Width, Height);

and save it to a file (png or something).

What's the easiest way to do this?

Thanks,

Dave

finally got it working...

//compile and link with
// g++ main.cpp -o ss -I/usr/include/QtGui -lQtGui

 #include <QWidget> 
 #include <QDesktopWidget>
 #include <QApplication>
 #include <QPixmap>


 void shootScreen(char* fileName);

 int main(int argc, char *argv[])
 {
	QApplication MyScreenshot(argc,argv);
	shootScreen("test.png");
	return 0;
 }

 void shootScreen(char* fileName)
 {
        QPixmap originalPixmap;
	originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), 100, 500, 200 , 50);//x, y, width, height
	originalPixmap.save(fileName);
 }
This article has been dead for over six months. Start a new discussion instead.