@echo off set new_color=#a59ea2 set new_color=#8d9594 set replace_color1=#470047 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 5x100 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 magick convert 0001.gif -extent 96x96 %new_file% goto :end :end del 0*.png del 0001.gif del 2_*.* del 3_*.*