Created
July 18, 2015 13:34
-
-
Save Sciss/19ee848622a05010b534 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys.process._ | |
| def maxSize(dir: File): (Int, Int) = { | |
| val xs = dir.children(_.ext.toLowerCase == "png") | |
| ((0, 0) /: xs) { case ((w, h), x) => | |
| val txt = Seq("identify", x.path).!! | |
| val words = txt.split(" ") | |
| require(words(1) == "PNG") | |
| val sub = words(2) | |
| val j = sub.indexOf('x') | |
| val w1 = sub.substring(0, j).toInt | |
| val h1 = sub.substring(j + 1).toInt | |
| math.max(w, w1) -> math.max(h, h1) | |
| } | |
| } | |
| val dir = userHome/"Documents"/"devel"/"Grenzwerte"/"image_out" | |
| assert(dir.isDirectory) | |
| maxSize(dir) // (1395,1403) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment