Skip to content

Instantly share code, notes, and snippets.

@Sciss
Last active June 12, 2016 18:32
Show Gist options
  • Select an option

  • Save Sciss/03039a1216038c0f08c8 to your computer and use it in GitHub Desktop.

Select an option

Save Sciss/03039a1216038c0f08c8 to your computer and use it in GitHub Desktop.
val d = file("/media/hhrutz/MnemoN/BackupEzra091201/Users/rutz/Documents/Pictures/Scans/Ryoanji2009-04-04/")
def toMonoPNG(in: File, inExt: String = "tif"): Unit = {
val inFiles = in.children.filter(_.ext.toLowerCase == inExt).sortBy(_.name)
println("#!/bin/bash\n")
inFiles.foreach { inF =>
val outF = inF.replaceExt("png")
val cmd = s"convert -threshold 50% '$inF' '$outF'"
println(cmd)
}
}
toMonoPNG(d)
////////////////////////////////
val dIn = file("/home/hhrutz/Documents/projects/Eisenerz/photos/160612")
val dOut = dIn / "web_scale"
def resize50(in: File, out: File, inExt: String = "jpg"): Unit = {
val inFiles = in.children.filter(_.ext.toLowerCase == inExt).sortBy(_.name)
println("#!/bin/bash\n")
inFiles.foreach { inF =>
val outF = out / s"${inF.base}m.jpg"
require (!outF.exists())
val cmd = s"convert -resize 50% '$inF' '$outF'"
println(cmd)
}
}
resize50(dIn, dOut)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment