You can simplify the for loop by something like
#!/bin/bash
shopt -s globstar #assuming bash
for i in images/**/*.gif
do
convert ..... $f
done
or, if you don't use bash,
find images/ -type f -name '*.gif' -print0 | xargs -0 convert .... '{}'
# maybe xargs needs "-1" option to process only one file at a time
both versions call imagemagick's convert on all files ending in .gif in the images folder.
For testing, put an "echo" command in front of the "convert" .
You could also check out if there are Rust utilities which do what you want - you'd need to install these using "cargo install".