Skip to content

Instantly share code, notes, and snippets.

@takaheraw
Created January 15, 2016 08:01
Show Gist options
  • Select an option

  • Save takaheraw/570d4805453e0049e922 to your computer and use it in GitHub Desktop.

Select an option

Save takaheraw/570d4805453e0049e922 to your computer and use it in GitHub Desktop.

install

# yum -y install firefox
# yum -y install xorg-x11-server-Xvfb
# yum -y install ImageMagick 
# yum -y groupinstall "Japanese Support"
# yum -y install ipa-pgothic-fonts.noarch
# yum -y install ImageMagick.x86_64 ImageMagick-devel.x86_64

sample code

#! /usr/bin/env ruby

require "selenium-webdriver"
require 'rmagick'
 
driver = Selenium::WebDriver.for :firefox
driver.get("http://counting.hatelabo.jp/count/XXXXXXX")
driver.save_screenshot("hatena_counting.png")
driver.quit

image = Magick::ImageList.new("counter.png").crop(0, 68, 502, 250)
image.write("hatena_counting500x250.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment