Reputation: 649
I have created a .bat using Image Magick's 'convert' command to convert color profiles for .jpgs. The conversion works correctly however, the converted .jpg files are moved from source path to path of the .bat script.
@echo off
setlocal enabledelayedexpansion
set IMCONV="C:\Users\%username%\Desktop\Color_Check_v1.5\_Data\conversion_script\convert.exe"
Path C:\Users\%username%\Desktop\Color_Check_v1.5\_Data\conversion_script\
FOR %%f IN (C:\Users\%Username%\Desktop\Color_Check_v1.5\_Upload\*.jpg) DO (
%IMCONV% %%f -profile "C:\Users\%username%\Desktop\Color_Check_v1.5\_Data\color_profile\sRGB_Color_Space_Profile.icm" %%~nf.jpg
)
I am unable to find a solution other than adding a second command to move the converted .jpgs back to source folder & replace the non-converted .jpgs. I wish to avoid this second command.
move /y "C:\Users\%Username%\Desktop\Color_Check_v1.5\*.jpg" "C:\Users\%Username%\Desktop\Color_Check_v1.5\_Upload" >nul
Any thoughts on how to execute the script to replace the old .jpgs with the newly converted .jps in the source folder?
Upvotes: 2
Views: 3471
Reputation: 207365
Please make backup first and then try the following two suggestions.
mogrify
instead of a loopmogrify -profile xyz.icm "C:\Users\%Username%\Desktop\Color_Check_v1.5\_Upload\*.jpg"
FOR %% IN ... DO (
convert %%f -profile xyz.icm %%f
)
Upvotes: 4