Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Documentation

  • Loading branch information...
commit 4716c772a4f5cb5740c0007380917b2534d2f076 1 parent f01a62d
@topfunky authored
Showing with 11 additions and 5 deletions.
  1. +1 −0  History.txt
  2. +9 −4 README.txt
  3. +1 −1  test/test_osxscreenshot.rb
View
1  History.txt
@@ -1,5 +1,6 @@
=== 0.0.2 / 2010-02-16
+* Added simple usage example.
* Minor URL changes.
* Noted ImageMagick/mogrify command-line requirement.
View
13 README.txt
@@ -5,7 +5,7 @@
== DESCRIPTION:
Wrapper around webkit2png.py to easily and programmatically capture
-screenshots, crop, and resize them on Mac OS X.
+screenshots of websites, then crop and resize them. Mac OS X only.
== FEATURES/PROBLEMS:
@@ -23,9 +23,14 @@ screenshots, crop, and resize them on Mac OS X.
== DEVELOPERS:
-Call the +capture+ method with the desired URL and some (optional) options.
+Call the +capture+ method which returns the path to a tempfile containing the image:
- output_screenshot_path =
+ file_path = OSX::Screenshot.capture("http://peepcode.com")
+ # => "/tmp/20293-202020293-2020-full.png" at 320x480
+
+Or, pass some (optional) options.
+
+ file_path =
OSX::Screenshot.capture(my_url, {
:tmp => "#{Sinatra::Application.root}/tmp",
:webkit2png => "#{Sinatra::Application.root}/bin/webkit2png.py",
@@ -33,7 +38,7 @@ Call the +capture+ method with the desired URL and some (optional) options.
:width => 220,
:height => 270
})
- system "mv #{output_screenshot_path} #{local_path}"
+ system "mv #{file_path} #{permanent_path}"
== LICENSE:
View
2  test/test_osxscreenshot.rb
@@ -18,7 +18,7 @@ def test_loads_tall_url
def test_uses_custom_tmpdir
@tmpfile = OSX::Screenshot.capture("http://example.com", :tmpdir => "./tmp")
- assert_match /^\.\/tmp/, @tmpfile
+ assert_match(/^\.\/tmp/, @tmpfile)
assert File.exist?(@tmpfile)
end
Please sign in to comment.
Something went wrong with that request. Please try again.