With some help I've made this code:
mkdir SDtemp
copy *@2x*.png SDtemp
mogrify -format png -resize 50% SDtemp/*@2x*.png
pushd SDtemp
setlocal enableDelayedExpansion
for %%a in (*.png) do (
set "filename=%%~nxa"
set "purged_filename=!filename:@2x=!"
ren %%~nxa !purged_filename!
)
endlocal
move *.png ..
popd
rmdir /s /q SDtemp
I think, my problem is on this line:
mogrify -format png -resize 50% SDtemp/*@2x*.png
It doesn't resize correctly. An image that was 320x320 is now 50x50 and another image that was 600x140 is 50x12, really weird.
I want it to resize like this: 320x320 -> 160x160
Edit: I found the problem, I had to write %%
because %
is a special character.
Use double percent-signs:
mogrify -format png -resize 50%% SDtemp/*@2x*.png