A collection of simple bash scripts for image processing.
Automatically crops images based on their orientation (portrait or landscape).
./crop_images.sh [options]-l, --landscape <WxH>: Set dimensions for landscape images (default: 480x230).-p, --portrait <WxH>: Set dimensions for portrait images (default: 480x600).-o, --output <dir>: Set the output directory (default:cropped_images).-f, --file <file>: Process a single file instead of all images in the directory.-d, --directory <dir>: Process all images in the specified directory.-c, --circle: Crop images into a circular shape. Output will always be PNG.-cs, --circle-size <SIZE>: Set the diameter for circular crops (default: 400).
./crop_images.sh -l 800x600 -o my_cropsTo process a single file:
./crop_images.sh -f my_image.jpg -o my_cropsTo process all images in a specific directory:
./crop_images.sh -d /path/to/images -o my_cropsTo crop images into a circle:
./crop_images.sh -f my_image.jpg -c -cs 200Converts .jpg, .jpeg, and .png images to .webp format.
./convert_to_webp.sh [options]-q, --quality <0-100>: Set the WebP quality (default: 80).-o, --output <dir>: Set the output directory (default:webp_images).-f, --file <file>: Process a single file instead of all images in the directory.-d, --directory <dir>: Process all images in the specified directory.
To convert images with a quality of 90 and save them in a converted directory:
./convert_to_webp.sh -q 90 -o convertedTo convert all images in a specific directory:
./convert_to_webp.sh -d /path/to/images -q 90 -o converted