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

surely someone knows how to do this??

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);
 }

actually is there a way to do this without dealing with all the QT nonsense?

I know very simple and nice tool for make, edit, save and share screenshots http://xscreenshot.com
Builded on QT

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.