2

I need to repeatedly capture a fixed region from each of a sequence of web pages to a series of images that I can then compile to a PDF. Ideally I could just navigate from page to page and press a hot key to capture the area and save the image to an automatically incremented filename each time.

What I want to stop doing is manually defining the region each time (it's irritating and when I drag to create the region it's even more irritating to try to get the exact pixel dimensions correct), which seems to be the only option with Skitch and others I have tried.

What software will allow me to do this most efficiently?

3

You can use screencapture commandline utility. Create an Automator Service (takes no input) which will do a shell command and assign keyboard shortcut to it.

The shell script will look like this:

/usr/sbin/screencapture -R0,0,1000,400 /path/to/save/FileName$(date +"%m_%d_%Y_%H_%M_%S_%s").png

screencapture has -R modifier not listed in man but it's listed in help as:

-R<x,y,w,h> capture screen rect

The values I used above captured this image which also shows how the rect coordinates worked.

Change x,y,w,h values for those You need.

The date +"%m_%d_%Y_%H_%M_%S_%s" adds a timestamp to the file name

enter image description here


You can actually use Screencapture to find the rect you want by using cmd +shift+4 which will give you some cross hairs with the numbers on for click drag release capture rect.

enter image description here


In Terminal.app typing: /usr/sbin/screencapture -h will give you the help documentation

usage: screencapture [-icMPmwsWxSCUtoa] [files]
  -c         force screen capture to go to the clipboard
  -C         capture the cursor as well as the screen. only in non-interactive modes
  -d         display errors to the user graphically
  -i         capture screen interactively, by selection or window
               control key - causes screen shot to go to clipboard
               space key   - toggle between mouse selection and
                             window selection modes
               escape key  - cancels interactive screen shot
  -m         only capture the main monitor, undefined if -i is set
  -M         screen capture output will go to a new Mail message
  -o         in window capture mode, do not capture the shadow of the window
  -P         screen capture output will open in Preview
  -s         only allow mouse selection mode
  -S         in window capture mode, capture the screen not the window
  -t<format> image format to create, default is png (other options include pdf, jpg, tiff and other formats)
  -T<seconds> Take the picture after a delay of <seconds>, default is 5
  -w         only allow window selection mode
  -W         start interaction in window selection mode
  -x         do not play sounds
  -a         do not include windows attached to selected windows
  -r         do not add dpi meta data to image
  -l<windowid> capture this windowsid
  -R<x,y,w,h> capture screen rect
  files   where to save the screen capture, 1 file per screen
  • Thank you so much. I had no idea that there was a command-line screencapture command! I'll use this with Keyboard Maestro and...done! – Chris Jan 14 '15 at 17:00
1

Have you considered batch cropping the screenshots? For example, using Imagemagick (which you can install via homebrew: brew install imagemagick):

cp original.png test.png #backup original!
mogrify -crop 800x600+100+200 +repage test.png

where 800x600 is the size of the region, and +100+200 the X/Y offset. This can be applied to several images at once by simply specifying several filenames. Note that this will modify your images (in-place), so operate on copies.

  • I can only mark one answer as "the" answer, but this is a useful approach I never even though of (and will make use of in the future. I even use ImageMagick for other tasks...). Thank you! – Chris Jan 14 '15 at 17:00
  • This is a very helpful answer, too – U2m Aug 31 '18 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .