I use this batch script very often to collate images side by side using ImageMagick, and it serves well the purpose, unless I am facing images whose file names start with digits.
Example:
ThisImage1.JPG
ThisImage2.JPG
...
ThisImage6.JPG
will be first renamed to:
A1.JPG
A2.JPG
...
A6.JPG
then collated 2 by 2 into:
B1.JPG
B3.JPG
B5.JPG
But if the images are originally named like:
111.JPG
112.JPG
...
116.JPG
then the preliminary renaming will be:
A2.JPG
A3.JPG
...
A7.JPG
which is a mistake of course...
Can this be solved?
My batch script:
SETLOCAL EnableDelayedExpansion
SET IMCONV="%PROGRAMFILES%\ImageMagick-7.0.4-Q16\Convert"
SET COUNT=0
setlocal ENABLEDELAYEDEXPANSION
FOR /R %%T IN (*.jpg) DO (
SET /A COUNT=!COUNT!+1
REN %%T A!COUNT!.jpg
)
:EOF
@echo off
set count=0
for %%x in (*.jpg) do set /a count+=1
set /a demi=%count% / 2
FOR /L %%x IN (1,2,%count%) DO (
set /a y = %%x + 1
%IMCONV% A%%x.jpg A!y!.jpg +append B%%x.jpg
)
endlocal