A lot of PDF printers cut photos into horizontal stripes or even tiles. You can extract these sniplets with the help of the xpdf tools and re-combine them with Montage, preferably sending their filenames to a batch file via SendTo. However, the filenames are not sorted by name when sent. So how do you sort the command line parameters?
Solution:
Code: Select all
SETLOCAL EnableDelayedExpansion
::
:: send the command line parameters (i.e. filenames) line-wise to a text file
:: and sort them
DEL list*.txt
For %%i in (%*) DO Echo %%i >> List.txt
SORT list.txt >list2.txt
::
:: you cannot just hand over the list to Montage via @list2.txt
:: as this does not handle filenames with spaces correctly,
:: thus you have to assemble them in one line again.
:: The usual delimiters have to be blocked.
SET var=
FOR /f "delims=" %%i in (list2.txt) DO (
SET var=!var! %%i
)
Montage !VAR! -tile 1x -geometry +0+0 "%~dpn1_m%~x1"
::
DEL list*.txt