Get image01 dimensions and use same to resize other images
Posted: 2016-10-08T02:14:44-07:00
I got a image01.jpg and some 50 images in folder Y with different dimensions. I want to convert and resize image01.jpg 50 images have each the dimensions obtained folder Y 50 images and have the output in folder z.
With little hands on Batch scripting and googling: the below script does 50 image output to folder z but size is same as image01.jpg. Kindly help.
With little hands on Batch scripting and googling: the below script does 50 image output to folder z but size is same as image01.jpg. Kindly help.
Code: Select all
setlocal enabledelayedexpansion
%~d1
CD "%~p1"
MD small
FOR %%f in (*.jpg) DO (
set filename=%%f
identify -format "%%w" %%f > w.txt
set /p w=<w.txt
identify -format "%%h" %%f > h.txt
set /p h=<h.txt)
FOR %%f in (*.jpg) DO (
set filename=%%f
convert imageA.jpg -resize %w%x%h%! small\%%~nxf
)
)