Skip to content

Instantly share code, notes, and snippets.

@selbyk
Created May 7, 2015 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selbyk/a32736a1b4c58670185b to your computer and use it in GitHub Desktop.
Save selbyk/a32736a1b4c58670185b to your computer and use it in GitHub Desktop.
Shell script to process a subset of facial recognition image database from UMass.
#/bin/bash
# Usage: ./batch_resize.sh input_dir output_dir “10 30 50”
# ./batch_resize.sh help
# Setup our globals
PARAM_CHECK_FAIL=0
INPUT_DIR=""
OUTPUT_DIR=""
SIZES=()
IMAGES_PROCESSED=0
IMAGES_PRODUCED=0
ORIGINALS_SIZE=0
RESIZED_SIZE=0
# Function to quit
function quit {
exit
}
# Resets the environment to run our tests
function reset {
PARAM_CHECK_FAIL=0
INPUT_DIR=""
OUTPUT_DIR=""
SIZES=()
}
# Prints the help menu
function help_menu {
echo '# ./batch_resize.sh - A tool for resizing images'
echo '# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES'
echo '# input_dir - directory where images are stored'
echo '# output_dir - directory where images should be saved'
echo '# sizes - string of integers seperated by spaces representing the'
echo -e '# the percentages to which the images will be scaled\n#'
echo -e '# Example: ./batch_resize.sh ./input ./output “10 30 50...”\n#'
echo '# Help: ./batch_resize.sh help'
echo -e '# --- Displays this menu\n#'
echo '# Test: ./batch_resize.sh test'
echo '# --- Runs all the test configuration and logs them to file\n'
}
# Setup params from input arguments
function setup_params {
INPUT_DIR=$1
OUTPUT_DIR=$2
SIZES=($3)
}
# Validate global params to make sure they're acceptable before processing
function check_params {
if [ -z "$INPUT_DIR" ]; then
echo "# Error: input dir not given"
PARAM_CHECK_FAIL=1
else
if [ "$INPUT_DIR" != "help" ]; then
if [ ! -d "$INPUT_DIR" ]; then
echo "# Error: input dir doesn't exist"
PARAM_CHECK_FAIL=1
fi
if [ -z "$OUTPUT_DIR" ]; then
echo "# Error: output dir not given"
PARAM_CHECK_FAIL=1
else
if [ -d "$OUTPUT_DIR" ]; then
echo "# Warning: ouput dir exists, files may be overwritten... exiting"
PARAM_CHECK_FAIL=1
fi
fi
if [ -z "$SIZES" ]; then
echo "# Error: sizes not given"
PARAM_CHECK_FAIL=1
else
for SIZE in "${SIZES[@]}"; do
if ! [[ "$SIZE" =~ ^[0-9]+$ ]]; then
echo "# Error: sizes in incorrect format, should be \"int int int...\""
PARAM_CHECK_FAIL=1
fi
done
fi
fi
fi
if [ "$PARAM_CHECK_FAIL" -eq "1" ]; then
echo "# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'"
echo "# Run './batch_resize.sh help' for more information"
fi
}
# Process the images using the validated arguments
function process_images {
for IMAGE_PATH in $INPUT_DIR/**/*.jpg; do
# Get path new images will reside in and ensure it exists
DIR=$(echo "$IMAGE_PATH" | sed -r "s#^$INPUT_DIR(.*)/(.*)\.jpg#$OUTPUT_DIR\1#gm")
mkdir -p $DIR
# File stub to append size and extention to
FILE_STUB=$(echo "$IMAGE_PATH" | sed -r "s#^$INPUT_DIR(.*)/(.*)\.jpg#$OUTPUT_DIR\1/\2#gm")
# Might as well get the oiginal image data outside of the SIZES loop
OLD_IMAGE_SIZE=$(wc -c $IMAGE_PATH | awk '{print $1;}')
# Update global original tallys
IMAGES_PROCESSED=$(($IMAGES_PROCESSED+1))
ORIGINALS_SIZE=$(($ORIGINALS_SIZE+$OLD_IMAGE_SIZE))
for SIZE in "${SIZES[@]}"; do
# Run convertion commands for each size in SIZES
NEW_IMAGE_PATH=$(echo "$FILE_STUB-r$SIZE.jpg")
convert -resize $SIZE% $IMAGE_PATH $NEW_IMAGE_PATH
NEW_IMAGE_SIZE=$(wc -c $NEW_IMAGE_PATH | wc -c - | awk '{print $1;}')
# Update the user on our progress
echo "Conversion complete!"
echo " Original: $IMAGE_PATH, Size: $OLD_IMAGE_SIZE"
echo " Resized: $NEW_IMAGE_PATH, Size: $NEW_IMAGE_SIZE"
# Update global resized tallys
IMAGES_PRODUCED=$(($IMAGES_PRODUCED+1))
RESIZED_SIZE=$(($RESIZED_SIZE+$NEW_IMAGE_SIZE))
done
done
}
# Print the final processing data
function report_final {
echo -e "All images have finished converting!\n"
echo "FINAL REPORT"
echo " # IMAGES PROCESSED: $IMAGES_PROCESSED"
echo " # IMAGES PRODUCED: $IMAGES_PRODUCED"
echo " ORIGINALS SIZE TOTAL: $ORIGINALS_SIZE"
echo " RESIZED SIZE TOTAL REPORT: $RESIZED_SIZE"
}
# Runs all our functions so that they do something useful
function run {
# Set up user input args into environment vars
setup_params "$@"
# Validate the params to make sure they're usable
check_params
if [ "$PARAM_CHECK_FAIL" -eq "0" ]; then # Safe to continue!
if [[ "$1" == "help" ]]; then # Safe to continue!
help_menu
else
process_images
report_final
fi
fi
}
# Test all the potential configurations
function test {
# Configuration options
POTENTIAL_INPUT=(help ./input_missing ./lfw)
POTENTIAL_OUTPUT=(./output_missing ./output)
POTENTIAL_SIZES=(""
10\ 2.3\ 25
six
10\ 30\ 50)
# Do a little house keeping for testing
if [ -d ./input_missing ]; then
rm -fr ./input_missing
fi
if [ -d ./output_missing ]; then
rm -fr ./output_missing
fi
# Empty out log file
> ./test.log
# Run all combinations of the tests
for INPUT in ${POTENTIAL_INPUT[@]}; do
reset
echo -e ">>> Test configuration: './batch_resize.sh $INPUT'\n" >> ./test.log
run $INPUT >> ./test.log
echo -e "\nFinished.\n" >> ./test.log
done
for INPUT in ${POTENTIAL_INPUT[@]}; do
for OUTPUT in ${POTENTIAL_OUTPUT[@]}; do
reset
echo -e ">>> Test configuration: './batch_resize.sh $INPUT $OUTPUT'\n" >> ./test.log
run $INPUT $OUTPUT >> ./test.log
echo -e "\nFinished.\n" >> ./test.log
done
done
for INPUT in "${POTENTIAL_INPUT[@]}"; do
for OUTPUT in "${POTENTIAL_OUTPUT[@]}"; do
for SIZE in "${POTENTIAL_SIZES[@]}"; do
reset
echo -e ">>> Test configuration: './batch_resize.sh $INPUT $OUTPUT \"$SIZE\"'\n" >> ./test.log
run $INPUT $OUTPUT $SIZE >> ./test.log
echo -e "\nFinished.\n" >> ./test.log
done
done
done
}
# Let's do it!
if [ "$1" == "test" ]; then
echo -e "You can find the test results in ./test.log"
test
else
run "$@"
fi
# Time to say good-bye
quit
>>> Test configuration: './batch_resize.sh help'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing'
# Error: input dir doesn't exist
# Error: output dir not given
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw'
# Error: output dir not given
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh help ./output_missing'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output_missing'
# Error: input dir doesn't exist
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output'
# Error: input dir doesn't exist
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output_missing'
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output'
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh help ./output_missing ""'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output_missing "10 2.3 25"'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output_missing "six"'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output_missing "10 30 50"'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output ""'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output "10 2.3 25"'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output "six"'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh help ./output "10 30 50"'
# ./batch_resize.sh - A tool for resizing images
# Main Usage: ./batch_resize.sh INPUT_DIR OUTPUT_DIR SIZES
# input_dir - directory where images are stored
# output_dir - directory where images should be saved
# sizes - string of integers seperated by spaces representing the
# the percentages to which the images will be scaled
#
# Example: ./batch_resize.sh ./input ./output “10 30 50...”
#
# Help: ./batch_resize.sh help
# --- Displays this menu
#
# Test: ./batch_resize.sh test
# --- Runs all the test configuration and logs them to file\n
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output_missing ""'
# Error: input dir doesn't exist
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output_missing "10 2.3 25"'
# Error: input dir doesn't exist
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output_missing "six"'
# Error: input dir doesn't exist
# Error: sizes in incorrect format, should be "int int int..."
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output_missing "10 30 50"'
# Error: input dir doesn't exist
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output ""'
# Error: input dir doesn't exist
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output "10 2.3 25"'
# Error: input dir doesn't exist
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output "six"'
# Error: input dir doesn't exist
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: sizes in incorrect format, should be "int int int..."
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./input_missing ./output "10 30 50"'
# Error: input dir doesn't exist
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output_missing ""'
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output_missing "10 2.3 25"'
Conversion complete!
Original: ./lfw/Aaron_Eckhart/Aaron_Eckhart_0001.jpg, Size: 10828
Resized: ./output_missing/Aaron_Eckhart/Aaron_Eckhart_0001-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Billy_Rork/Billy_Rork_0001.jpg, Size: 10588
Resized: ./output_missing/Billy_Rork/Billy_Rork_0001-r10.jpg, Size: 56
Conversion complete!
Original: ./lfw/Charlie_Sheen/Charlie_Sheen_0001.jpg, Size: 11280
Resized: ./output_missing/Charlie_Sheen/Charlie_Sheen_0001-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Danny_Green/Danny_Green_0001.jpg, Size: 14356
Resized: ./output_missing/Danny_Green/Danny_Green_0001-r10.jpg, Size: 58
Conversion complete!
Original: ./lfw/Elena_de_Chavez/Elena_de_Chavez_0001.jpg, Size: 19890
Resized: ./output_missing/Elena_de_Chavez/Elena_de_Chavez_0001-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Felix_Doh/Felix_Doh_0001.jpg, Size: 14285
Resized: ./output_missing/Felix_Doh/Felix_Doh_0001-r10.jpg, Size: 54
Conversion complete!
Original: ./lfw/Filippo_Volandri/Filippo_Volandri_0001.jpg, Size: 14986
Resized: ./output_missing/Filippo_Volandri/Filippo_Volandri_0001-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Gao_Qiang/Gao_Qiang_0001.jpg, Size: 15741
Resized: ./output_missing/Gao_Qiang/Gao_Qiang_0001-r10.jpg, Size: 54
Conversion complete!
Original: ./lfw/Gao_Qiang/Gao_Qiang_0002.jpg, Size: 14800
Resized: ./output_missing/Gao_Qiang/Gao_Qiang_0002-r10.jpg, Size: 54
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0001.jpg, Size: 17310
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0001-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0002.jpg, Size: 14802
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0002-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0003.jpg, Size: 16223
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0003-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0004.jpg, Size: 19889
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0004-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0005.jpg, Size: 13668
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0005-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0006.jpg, Size: 15306
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0006-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0007.jpg, Size: 14070
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0007-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0008.jpg, Size: 14833
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0008-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0009.jpg, Size: 13059
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0009-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0010.jpg, Size: 14210
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0010-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0011.jpg, Size: 11254
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0011-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harrison_Ford/Harrison_Ford_0012.jpg, Size: 15386
Resized: ./output_missing/Harrison_Ford/Harrison_Ford_0012-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Harry_Kalas/Harry_Kalas_0001.jpg, Size: 12963
Resized: ./output_missing/Harry_Kalas/Harry_Kalas_0001-r10.jpg, Size: 58
Conversion complete!
Original: ./lfw/Harry_Kalas/Harry_Kalas_0002.jpg, Size: 12331
Resized: ./output_missing/Harry_Kalas/Harry_Kalas_0002-r10.jpg, Size: 58
Conversion complete!
Original: ./lfw/Henry_Kissinger/Henry_Kissinger_0001.jpg, Size: 14235
Resized: ./output_missing/Henry_Kissinger/Henry_Kissinger_0001-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Imelda_Marcos/Imelda_Marcos_0001.jpg, Size: 17052
Resized: ./output_missing/Imelda_Marcos/Imelda_Marcos_0001-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Juanes/Juanes_0001.jpg, Size: 15035
Resized: ./output_missing/Juanes/Juanes_0001-r10.jpg, Size: 48
Conversion complete!
Original: ./lfw/Juanes/Juanes_0002.jpg, Size: 16951
Resized: ./output_missing/Juanes/Juanes_0002-r10.jpg, Size: 48
Conversion complete!
Original: ./lfw/Juanes/Juanes_0003.jpg, Size: 17428
Resized: ./output_missing/Juanes/Juanes_0003-r10.jpg, Size: 48
Conversion complete!
Original: ./lfw/Kay_Bailey_Hutchison/Kay_Bailey_Hutchison_0001.jpg, Size: 12323
Resized: ./output_missing/Kay_Bailey_Hutchison/Kay_Bailey_Hutchison_0001-r10.jpg, Size: 76
Conversion complete!
Original: ./lfw/Madonna/Madonna_0001.jpg, Size: 13637
Resized: ./output_missing/Madonna/Madonna_0001-r10.jpg, Size: 50
Conversion complete!
Original: ./lfw/Madonna/Madonna_0002.jpg, Size: 9424
Resized: ./output_missing/Madonna/Madonna_0002-r10.jpg, Size: 50
Conversion complete!
Original: ./lfw/Madonna/Madonna_0003.jpg, Size: 11363
Resized: ./output_missing/Madonna/Madonna_0003-r10.jpg, Size: 50
Conversion complete!
Original: ./lfw/Madonna/Madonna_0004.jpg, Size: 18068
Resized: ./output_missing/Madonna/Madonna_0004-r10.jpg, Size: 50
Conversion complete!
Original: ./lfw/Madonna/Madonna_0005.jpg, Size: 16713
Resized: ./output_missing/Madonna/Madonna_0005-r10.jpg, Size: 50
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0001.jpg, Size: 15884
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0001-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0002.jpg, Size: 14285
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0002-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0003.jpg, Size: 12511
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0003-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0004.jpg, Size: 13264
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0004-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0005.jpg, Size: 13164
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0005-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0006.jpg, Size: 14466
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0006-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0007.jpg, Size: 11515
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0007-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0008.jpg, Size: 13086
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0008-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0009.jpg, Size: 12632
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0009-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0010.jpg, Size: 13285
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0010-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0011.jpg, Size: 12092
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0011-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michael_Jackson/Michael_Jackson_0012.jpg, Size: 13944
Resized: ./output_missing/Michael_Jackson/Michael_Jackson_0012-r10.jpg, Size: 66
Conversion complete!
Original: ./lfw/Michelle_Yeoh/Michelle_Yeoh_0001.jpg, Size: 12468
Resized: ./output_missing/Michelle_Yeoh/Michelle_Yeoh_0001-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Michelle_Yeoh/Michelle_Yeoh_0002.jpg, Size: 13445
Resized: ./output_missing/Michelle_Yeoh/Michelle_Yeoh_0002-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Michelle_Yeoh/Michelle_Yeoh_0003.jpg, Size: 12885
Resized: ./output_missing/Michelle_Yeoh/Michelle_Yeoh_0003-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Michelle_Yeoh/Michelle_Yeoh_0004.jpg, Size: 13242
Resized: ./output_missing/Michelle_Yeoh/Michelle_Yeoh_0004-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Michelle_Yeoh/Michelle_Yeoh_0005.jpg, Size: 13889
Resized: ./output_missing/Michelle_Yeoh/Michelle_Yeoh_0005-r10.jpg, Size: 62
Conversion complete!
Original: ./lfw/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0001.jpg, Size: 17489
Resized: ./output_missing/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0001-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0002.jpg, Size: 12475
Resized: ./output_missing/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0002-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0003.jpg, Size: 13252
Resized: ./output_missing/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0003-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0004.jpg, Size: 18785
Resized: ./output_missing/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0004-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0005.jpg, Size: 14027
Resized: ./output_missing/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0005-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0006.jpg, Size: 13124
Resized: ./output_missing/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0006-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0007.jpg, Size: 19282
Resized: ./output_missing/Oscar_De_La_Hoya/Oscar_De_La_Hoya_0007-r10.jpg, Size: 68
Conversion complete!
Original: ./lfw/Princess_Diana/Princess_Diana_0001.jpg, Size: 14320
Resized: ./output_missing/Princess_Diana/Princess_Diana_0001-r10.jpg, Size: 64
Conversion complete!
Original: ./lfw/Zoran_Djindjic/Zoran_Djindjic_0001.jpg, Size: 14293
Resized: ./output_missing/Zoran_Djindjic/Zoran_Djindjic_0001-r10.jpg, Size: 64
Conversion complete!
Original: ./lfw/Zoran_Djindjic/Zoran_Djindjic_0002.jpg, Size: 12085
Resized: ./output_missing/Zoran_Djindjic/Zoran_Djindjic_0002-r10.jpg, Size: 64
Conversion complete!
Original: ./lfw/Zoran_Djindjic/Zoran_Djindjic_0003.jpg, Size: 13269
Resized: ./output_missing/Zoran_Djindjic/Zoran_Djindjic_0003-r10.jpg, Size: 64
Conversion complete!
Original: ./lfw/Zoran_Djindjic/Zoran_Djindjic_0004.jpg, Size: 12827
Resized: ./output_missing/Zoran_Djindjic/Zoran_Djindjic_0004-r10.jpg, Size: 64
All images have finished converting!
FINAL REPORT
# IMAGES PROCESSED: 63
# IMAGES PRODUCED: 63
ORIGINALS SIZE TOTAL: 895572
RESIZED SIZE TOTAL REPORT: 3890
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output_missing "six"'
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: sizes in incorrect format, should be "int int int..."
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output_missing "10 30 50"'
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output ""'
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: sizes not given
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output "10 2.3 25"'
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output "six"'
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: sizes in incorrect format, should be "int int int..."
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
>>> Test configuration: './batch_resize.sh ./lfw ./output "10 30 50"'
# Warning: ouput dir exists, files may be overwritten... exiting
# Error: input must be in the form './batch_resize.sh input_dir output_dir sizes'
# Run './batch_resize.sh help' for more information
Finished.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment