Skip to content

Instantly share code, notes, and snippets.

@tizzo
Created December 11, 2012 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tizzo/4260589 to your computer and use it in GitHub Desktop.
Save tizzo/4260589 to your computer and use it in GitHub Desktop.
Quick gist to demonstrate taking screenshots at different resolutions
console.log 'started'
options =
viewportSize:
width: 1900
height: 1000
snapshot = (width, height, path)->
clip =
top: 0
width: width
height: height
left: 0
casper.viewport width, height
casper.then ->
casper.capture path, clip
console.log "snapped #{path}"
console.log 'options'
casper = require('casper').create options
url = casper.cli.args[0]
console.log 'required'
casper.start url, ->
console.log 'loaded'
snapshot 1900, 1000, 'screenshots/desktop.png'
@then ->
snapshot 320, 480, "screenshots/iphone.png"
@then ->
snapshot 820, 650, "screenshots/oddball.png"
@then ->
snapshot 768, 1024, "screenshots/ipad.png"
casper.run ->
@echo('done').exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment