Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
dir = ARGV[0]
batch_size = ARGV[1] || 100
all_files = Dir.glob("#{dir}/*")
num = 0
all_files.each_slice(batch_size) do |files|
cmd = "zip zip-#{num}.zip #{files.join(" ")}"
`#{cmd}`
@sallain
sallain / split-vertical.md
Last active August 29, 2015 14:02 — forked from pbinkley/gist:8a69805a4e50ff823630
Split image files vertically down the centre and rename to filename-01.tif, filename-02.tif, etc.

Dependencies

Steps

  1. Create a test directory containing a few of the pages
  2. Run the following command on the test directory:
convert -crop 50%x100% +repage *.tif desiredfilename-%d.tif
  1. Check your files. If they look nice, run the command on all the files!
  2. If the crop is slightly off, you might need to adjust the -crop percentage - test out 51%x100%, 52%x100%, etc. Play around until ImageMagick is producing the output you expect