Posted on Sunday, 5th August 2007 by Lee
I have a custom little utility that I wrote that uses ImageMagick and Zenity to take a screen shot. I have the script hooked up to
#!/bin/bash fn=$(zenity --entry --title='File Name' --text='File Name Prefix'); dt=`date '+%Y%m%d'`; screenshot="/home/USERNAME/Desktop/$fn-$dt.png"; import -frame +repage $screenshot;
Be sure to change USERNAME to your actual username so the path to your desktop will be correct. Also, for the sake of your sanity, please note the +repage switch that we pass to ImageMagick’s import command. Without that, Gimp will be very unhappy with the offset of the PNG. The layer will appear outside of the image and you won’t be able to see your screen shot in Gimp. If you happen to have that problem already, you can zoom out in Gimp, then use the move tool to drag your image back into view.
The screen shot utility, when invoked, will first prompt you for a little file name prefix using zenity. That prefix will have a date appended to the end of the saved file name. So, for example, if you ran this script today and typed in “receipt” as the file name prefix, the final saved image will be named “receipt-20070804.png” since today is August 4th, 2007. After typing in your file name prefix, you will see a + style cursor. Either click on a window or click and drag a selection on your screen to take the screen shot. The sreen shot will be saved to your desktop.
Posted in Uncategorized | Comments (3)











January 9th, 2008 at 11:49 pm
Thanks, the +repage tip saved me from frustration when I was ripping game sprites from a sprite sheet.
January 27th, 2008 at 1:33 am
Yeah, that +repage thing is a lifesaver! Gimp has been driving me nuts with the messed up PNG offset — really nice to find a fix for that. And nice to be introduced to zenity, too! I’ve been wondering what it was for, but never looked into it. Now I know!
July 6th, 2008 at 3:52 pm
Thanks for putting this up. +repage to remove the offsets in the PNG is the tiny gem I needed!