@echo off setlocal enabledelayedexpansion set new_color=#a59ea2 set new_color=#8d9594 set replace_color1=#470047 REM Remove the 2nd frames to speed up the animation. set /A c=0 for %%a in ("*.png") do ( set /A c+=1 set /A r=c%%2 if !r!==0 del %%a echo "file: %%a !c! r: !r! " ) magick convert 0*.png -loop 0 -layers OptimizeFrame 3_%1 magick convert 3_%1 -fuzz 10%% -fill %new_color% -opaque %replace_color1% 2_%1 rem delay only works on gif to gif conversion magick convert -delay 10x100 2_%1 %1 rem magick convert -delay 2x100 2_%1 %1 set filename=%1 rem make sure that the .gif (.png) is replaced with _gif or _png set filename=%filename:.=_.% for %%a in ("%filename:_=" "%") do ( if %%a == "walk" goto :replace_walk ) goto :end :replace_walk set str=%filename:walk=idle% set new_file=%str:_.gif=.png% magick convert 0001.png 3_0001.gif magick convert 3_0001.gif -fuzz 10%% -fill %new_color% -opaque %replace_color1% 0001.gif rem magick convert 0001.gif -extent 96x96 %new_file% magick convert 0001.gif -extent 1024x1024 %new_file% goto :end :end del 0*.png del 0001.gif del 2_*.* del 3_*.* :the_end