Skip to content

Instantly share code, notes, and snippets.

@danhorst
Created August 2, 2024 18:54
Show Gist options
  • Select an option

  • Save danhorst/20304edd8bcfd83da0652b73836253b5 to your computer and use it in GitHub Desktop.

Select an option

Save danhorst/20304edd8bcfd83da0652b73836253b5 to your computer and use it in GitHub Desktop.
Convert a picture of a document to a "scanned" image
#!/usr/bin/env ruby
Dir.glob("src/*").each do |file|
destination = file.split("/").last
cmd = "magick #{file} -resize \"1000>\" -colorspace Gray -fill white -tint 120 -normalize PNG8:#{destination}"
puts cmd
`#{cmd}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment