Created
March 19, 2014 16:57
-
-
Save peaeater/9646158 to your computer and use it in GitHub Desktop.
Produces a JPG per JP2, given an input directory. Output size defaults to 1000px width, and output name mirrors source JP2s. Requires imagemagick.
This file contains 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
# convert .jp2 to .jpg | |
# requires imagemagick | |
Param( | |
[int]$size = 1000, | |
[string]$indir = ".", | |
[string]$outdir = ".\jpg" | |
) | |
if (!(test-path $outdir)) { | |
mkdir $outdir | |
} | |
$files = ls "$indir\*.*" -include *.jp2 | |
foreach ($file in $files) { | |
$input = ('"{0}"' -f $file.FullName) | |
$output = ('"{0}\{1}.jpg"' -f $outdir, $file.BaseName) | |
$args = "$input -resize $size $output" | |
write-host $args | |
start-process convert $args -wait -NoNewWindow | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment