Sha256: fc01ebd944046880f2f73d704b9218d7264c0d0a68fb8fcdbf930a512046ca14

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/env ruby
require 'optparse'

# Makes display figures based on the full-size figures.
# The idea is to avoid throwing away data by storing full-size figures,
# but resize them to a size appropriate for use in the document.

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: rename_screenshot [options]"

  opts.on("-a", "Regenerate all figures from full-size images") do
    options[:all] = true
  end

  opts.on("-w", "Resize to given width (in pixels)") do |width|
    options[:width] = width
  end
end.parse!

width = (options[:width] || "700") + '\>'
target_dir = "images/figures"
Dir.glob('full_size_figures/*').each do |full_size_filename|
  if full_size_filename =~ /(\w+)-full\.(.*)/
    # Needed for backwards compatibility.
    filename = "#{target_dir}/#{$1}.#{$2}"
  else
    filename = "#{target_dir}/#{File.basename(full_size_filename)}"
  end
  unless File.exist?(filename) && !options[:all]
    cmd =  "convert #{full_size_filename} -resize #{width} #{filename}"
    system cmd
  end
end
system "git add -A"

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
softcover-1.1.23 bin/make_figures
softcover-1.1.22 bin/make_figures
softcover-1.1.21 bin/make_figures
softcover-1.1.20 bin/make_figures
softcover-1.1.19 bin/make_figures
softcover-1.1.18 bin/make_figures
softcover-1.1.17 bin/make_figures
softcover-1.1.16 bin/make_figures
softcover-1.1.15 bin/make_figures