Skip to content

Instantly share code, notes, and snippets.

@ProGamerGov
Last active September 22, 2020 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ProGamerGov/956f676d9960a271a45b96fd938c3bca to your computer and use it in GitHub Desktop.
Save ProGamerGov/956f676d9960a271a45b96fd938c3bca to your computer and use it in GitHub Desktop.
Scripts that create rotated and reflected version of a specified image
#! /bin/bash
#Usage: ./alternate.sh <input.png>
#Dependency: sudo apt-get install imagemagick
#Permission fix troubleshooting: chmod u+x ./alternate.sh
# 1. Defines the input image as a variable
input=$1
input_file=`basename $input`
clean_name="${input_file%.*}"
# Creates the image variations with horizontal flips and rotations.
echo "Creating 3 variations of "$clean_name
echo "Rotating 180 degrees..."
convert -rotate 180 $input $clean_name'_rotate_180.png'
echo "Done"
echo "Rotating 180 degrees and flipping horizontally..."
convert -rotate 180 -flop $input $clean_name'_rotate_180_flop.png'
echo "Done"
echo "Flipping horizontally..."
convert -flop $input $clean_name'_flop.png'
echo "Done"
echo "Finished!"
#! /bin/bash
#Usage: ./alternate2.sh <input.png>
#Dependency: sudo apt-get install imagemagick
#Permission fix troubleshooting: chmod u+x ./alternate2.sh
# 1. Defines the input image as a variable
input=$1
input_file=`basename $input`
clean_name="${input_file%.*}"
# Creates the image variations with horizontal flips and rotations.
echo "Creating 7 variations of "$clean_name
#################################################
echo "Rotating 90 degrees..."
convert -rotate 90 $input $clean_name'_rotate_90.png'
echo "Done"
echo "Rotating 180 degrees..."
convert -rotate 180 $input $clean_name'_rotate_180.png'
echo "Done"
echo "Rotating 270 degrees..."
convert -rotate 270 $input $clean_name'_rotate_270.png'
echo "Done"
#################################################
echo "Rotating 90 degrees and flipping horizontally..."
convert -rotate 90 -flop $input $clean_name'_rotate_90_flop.png'
echo "Done"
echo "Rotating 180 degrees and flipping horizontally..."
convert -rotate 180 -flop $input $clean_name'_rotate_180_flop.png'
echo "Done"
echo "Rotating 270 degrees and flipping horizontally..."
convert -rotate 270 -flop $input $clean_name'_rotate_270_flop.png'
echo "Done"
echo "Flipping horizontally..."
convert -flop $input $clean_name'_flop.png'
echo "Done"
#################################################
echo "Finished!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment