ImageMagick: resizing single image with multiple image sizes with their names on windows
<p>I am try to get the width and height of some 50 images as variable and then with that variable trying to resize one particular image making 50 copies with those dimensions.
Below code is only giving single image output. Kindly help.</p>

<pre><code>setlocal enabledelayedexpansion  
  %~d1
  CD "%~p1"
  MD small
 FOR %%a in (*.jpg) DO (
    identify -format "%%w" imageA.jpg &gt; w.txt
    set /p w=&lt;w.txt
    identify -format "%%h" imageA.jpg &gt; h.txt
    set /p h=&lt;h.txt)
   FOR %%a in (*.jpg) DO (
    convert imageA.jpg -resize %w%x%h%! small\%%a
  )
)
</code></pre>

<p>I did some work around to the code and I am able to get copies of images with names in the specified folder, but dimension are not applied. how to fix this?</p>

<pre><code>setlocal enabledelayedexpansion  
  %~d1
  CD "%~p1"
  MD small

 FOR %%f in (*.jpg) DO (
  set filename=%%f
    identify -format "%%w" %%f &gt; w.txt
    set /p w=&lt;w.txt
    identify -format "%%h" %%f &gt; h.txt
    set /p h=&lt;h.txt)
   FOR %%f in (*.jpg) DO (
    set filename=%%f
    convert imageA.jpg -resize %w%x%h%! small\%%~nxf
  )
)
</code></pre>