Try imagemagick with screenshot...I think or something like that ...its part of the Gnome desktop environment