Skip to content

Instantly share code, notes, and snippets.

@mrowrpurr
Created June 16, 2022 01:03
Show Gist options
  • Save mrowrpurr/33b2551d4603ffa904ad72c8dffb1534 to your computer and use it in GitHub Desktop.
Save mrowrpurr/33b2551d4603ffa904ad72c8dffb1534 to your computer and use it in GitHub Desktop.
GREEN="#18C418"
PINK="#bf1fba"
TOLERANCE="27%"
for FRM in *.FRM
do
BASENAME="${FRM/.FRM}"
# Turn the .frm into 6 .gif (one for each isometric direction)
frm2gif -p color.pal "$FRM"
# Now you will have X_ne.gif X_e.gif etc etc...
for GIF in *.gif
do
# Edit the .gif files and replace the green hair with pink hair (not purrfect, but ok!)
magick "$GIF" -coalesce -fuzz "$TOLERANCE" -fill "$PINK" -opaque "$GREEN" -layers optimize "$GIF"
done
# Now convert each .gif to a .frm
for GIF in *.gif
do
gif2frm "$GIF"
# We no longer need the .gif
rm "$GIF"
done
# Remove the original FRM, we're about to recreate it from the multiple .frm
rm "$FRM"
# Combine the multiple new .frm into one .FRM to replace the original
frmcat "${BASENAME}_ne.frm" "${BASENAME}_e.frm" "${BASENAME}_se.frm" "${BASENAME}_sw.frm" "${BASENAME}_w.frm" "${BASENAME}_nw.frm" "$FRM"
# Remove the .frm
rm *.frm
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment