Processing .jpg (rotating) can degrade them so best off starting with not overwriting.
Download Imagemagick for Windows
From a batch file. Do not overwrite originals. Rotate 90 degrees clockwise:
@echo off
SETLOCAL ENABLEEXTENSIONS
md "path-to-parent-folder-with-double-quotes-if-there-is-a-space-in-the-path\rotated\"
for /f "tokens=*" %%x in ('dir /b "path-to-parent-folder-with-double-quotes-if-there-is-a-space-in-the-path\*.jpg"') do "path-to-imagemagick\convert.exe" "path-to-parent-folder-with-double-quotes-if-there-is-a-space-in-the-path\%%x" -rotate "90>" "path-to-parent-folder-with-double-quotes-if-there-is-a-space-in-the-path\rotated\%%x"
exit /b
For example:
@echo off
SETLOCAL ENABLEEXTENSIONS
md "%USERPROFILE%\Desktop\New folder\rotated\"
for /f "tokens=*" %%x in ('dir /b "%USERPROFILE%\desktop\new folder\*.jpg"') do "%ProgramFiles%\ImageMagick-7.0.7-Q16\convert.exe" "%USERPROFILE%\desktop\new folder\%%x" -rotate "90>" "%USERPROFILE%\desktop\new folder\rotated\%%x"
exit /b
From a batch file. Overwrite originals. Rotate 90 degrees clockwise:
@echo off
SETLOCAL ENABLEEXTENSIONS
for /f "tokens=*" %%x in ('dir /b "path-to-parent-folder-with-double-quotes-if-there-is-a-space-in-the-path\*.jpg"') do "path-to-imagemagick\convert.exe" "path-to-parent-folder-with-double-quotes-if-there-is-a-space-in-the-path\%%x" -rotate "90>" "path-to-parent-folder-with-double-quotes-if-there-is-a-space-in-the-path\%%x"
exit /b
For example:
@echo off
SETLOCAL ENABLEEXTENSIONS
for /f "tokens=*" %%x in ('dir /b "%USERPROFILE%\desktop\new folder\*.jpg"') do "%ProgramFiles%\ImageMagick-7.0.7-Q16\convert.exe" "%USERPROFILE%\desktop\new folder\%%x" -rotate "90>" "%USERPROFILE%\desktop\new folder\rotated\%%x"
exit /b
A windows shortcut that rotates 90 degrees clockwise and overwrites every .jpg in the directory it is started in:
cmd /c for /f "tokens=*" %x in ('dir /b *.jpg') do "%ProgramFiles%\ImageMagick-7.0.7-Q16\convert.exe" "%x" -rotate "90>" "%x"
A windows shortcut that rotates 90 degrees clockwise and overwrites every .jpg in the directory it is started in and in all the subdirectories:
cmd /c for /f "tokens=*" %x in ('dir /b /s *.jpg') do "%ProgramFiles%\ImageMagick-7.0.7-Q16\convert.exe" "%x" -rotate "90>" "%x"
rotate 90 degress clockwise
-rotate "90>"
rotate 90 degress counterclockwise
-rotate "-90>"
Apply Path image rotation (using shear operations) to the image.
Use > to rotate the image only if its width exceeds the height. < rotates the image only if its width is less than the height. For example, if you specify -rotate "-90>" and the image size is 480x640, the image is not rotated. However, if the image is 640x480, it is rotated by -90 degrees. If you use > or <, enclose it in quotation marks to prevent it from being misinterpreted as a file redirection.
Empty triangles in the corners, left over from rotating the image, are filled with the background color. The above is from here.
See also the -distort operator and specifically the 'ScaleRotateTranslate' distort method.
For more info about using imagemagick command line processing see here
1Are your images jpeg, and are you trying to rotate them selectively to be correctly upright? – harrymc – 2019-01-31T15:03:16.603
Yes, they're JPEGs. If by "selectively" you mean selecting only the ones I want (the wider ones), then that's right. – barbiedolphin – 2019-01-31T15:06:43.697