Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

1 - Install imagemagick

  • Mac: brew install imagemagick
  • Ubuntu Linux: Follow this guide

2 - Save the following script as split-icons.sh

SOURCE_DIR="Henry_PixelEffects"
DEST_DIR="pixel-effects-assets"

if [ ! -d "$SOURCE_DIR" ]; then exit 1; fi
if [ ! -d "$DEST_DIR" ]; then exit 1; fi

echo "Splitting files..."

convert "$SOURCE_DIR/BloodSplatter2.png" -crop 7x0@ "$DEST_DIR/blood_splatter2_%d.png"
convert "$SOURCE_DIR/Consume1.png" -crop 13x0@ "$DEST_DIR/consume1_%d.png"
convert "$SOURCE_DIR/Poison.png" -crop 8x0@ "$DEST_DIR/poison_%d.png"
convert "$SOURCE_DIR/Dark.png" -crop 9x0@ "$DEST_DIR/dark_%d.png"
convert "$SOURCE_DIR/Sleep.png" -crop 6x0@ "$DEST_DIR/sleep_%d.png"
convert "$SOURCE_DIR/ice0.png" -crop 9x0@ "$DEST_DIR/ice0_%d.png"
convert "$SOURCE_DIR/Fire0.png" -crop 8x0@ "$DEST_DIR/fire0_%d.png"
convert "$SOURCE_DIR/Water.png" -crop 10x0@ "$DEST_DIR/water_%d.png"
convert "$SOURCE_DIR/Earth0.png" -crop 8x0@ "$DEST_DIR/earth0_%d.png"
convert "$SOURCE_DIR/Slash1.png" -crop 7x0@ "$DEST_DIR/slash1_%d.png"
convert "$SOURCE_DIR/Spark1.png" -crop 10x0@ "$DEST_DIR/spark1_%d.png"

convert "$SOURCE_DIR/Consume2.png" -crop 13x0@ "$DEST_DIR/consume2_%d.png"
convert "$SOURCE_DIR/Bubble.png" -crop 14x0@ "$DEST_DIR/bubble_%d.png"
convert "$SOURCE_DIR/Circle.png" -crop 9x0@ "$DEST_DIR/circle_%d.png"
convert "$SOURCE_DIR/ice1.png" -crop 9x0@ "$DEST_DIR/ice1_%d.png"
convert "$SOURCE_DIR/Fire1.png" -crop 8x0@ "$DEST_DIR/fire1_%d.png"
convert "$SOURCE_DIR/Earth1.png" -crop 8x0@ "$DEST_DIR/earth1_%d.png"
convert "$SOURCE_DIR/ice2.png" -crop 9x0@ "$DEST_DIR/ice2_%d.png"
convert "$SOURCE_DIR/Fire2.png" -crop 8x0@ "$DEST_DIR/fire2_%d.png"
convert "$SOURCE_DIR/Earth2.png" -crop 8x0@ "$DEST_DIR/earth2_%d.png"
convert "$SOURCE_DIR/Flame.png" -crop 5x0@ "$DEST_DIR/flame_%d.png"

echo "Done"

3 - $chmod +x split-icons.sh

4 - Run it

$./mkdir my_dest_dir
$./split-icons.sh SOURCE_DIR="my_source_dir" DEST_DIR="my_dest_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.