Skip to content

Simple image processor - operates recursively on files and subdirectories in the target directory. Useful for batch processing client images.

License

Notifications You must be signed in to change notification settings

csknk/bash-image-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Image Crunch

A very simple Bash script that runs an Imagemagick command.

Operates recursively on files and subdirectories in the target directory.

Builds a target directory containing processed files, with the same directory structure as the original.

Uses Imagemagick.

Instructions

  • Add this file to a directory in your shell(Bash) path
  • Make it executable (sudo chmod +x /usr/local/bin/image-crunch)
  • In your terminal, move into the images directory
  • Enter image-crunch
  • Select a width when prompted
  • Select compression or not
  • Select a name for the new directory

The script copies all files and subdirectories into the newly specified subdirectory.

It then applies an Imagemagick command to all files in this directory:

if [ true == $compression ]
then
  # Imagemagick command on all files, recursive, with compression
  find ./ -name "*.jpg" -exec mogrify -resize $image_width -density 72 -quality "70%" {} \;
else
  # Imagemagick command on all files, recursive, No compression
  find ./ -name "*.jpg" -exec mogrify -resize $image_width -density 72 {} \;
fi

About

Simple image processor - operates recursively on files and subdirectories in the target directory. Useful for batch processing client images.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages