Created
November 29, 2013 18:06
-
-
Save peaeater/7709708 to your computer and use it in GitHub Desktop.
Produce a TIF per page from the input DJVU file. The output name is simply the page number of the current page. Requires ddjvu => http://djvu.sourceforge.net/doc/man/ddjvu.html
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
# extract tif per page from djvu | |
# requires djvulibre | |
param( | |
[Parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0)] | |
[string]$in | |
) | |
process | |
{ | |
$basePath = split-path $script:myinvocation.mycommand.path | |
$file = new-object System.IO.FileInfo([System.IO.Path]::Combine($basePath, $in)) | |
$input = ('"{0}"' -f $file.FullName) | |
$pagecount = & djvused -e 'n' $input | |
for ($i = 1; $i -le $pagecount; $i++) { | |
$output = ('"{0}\{1}.tif"' -f $file.DirectoryName, $i) | |
$args = "-format=tif -page=$i $input $output" | |
write-host $args | |
start-process ddjvu $args -NoNewWindow -wait | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment