Skip to content

ShortNaas/image_process

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Image Processing Script

A simple bash script to:

  1. Remove all metadata from images
  2. Reduce file size without quality loss
  3. Add -processed suffix to filenames (optional)
  4. Move processed files to a processed/ folder

Features

  • Supports JPG, JPEG, PNG, GIF, BMP, TIFF, WebP
  • Uses exiftool to strip metadata
  • Uses jpegoptim for JPEG optimization
  • Uses optipng for PNG optimization
  • Uses convert (ImageMagick) for other formats
  • Displays file size savings
  • Optional --keep-name flag to preserve original filenames instead of appending -processed

Installation

  1. Download the script to your preferred location, e.g.:

    curl -O https://example.com/image_process.sh
  2. Make it executable:

    chmod +x image_process.sh
  3. Move to a directory in your PATH:

    sudo mv image_process.sh /usr/local/bin/image_process

Alternative: Use ~/.local/bin

If you prefer a user-local installation without sudo, move the script to ~/.local/bin (ensure this directory is in your PATH):

mkdir -p ~/.local/bin
mv image_process.sh ~/.local/bin/image_process
chmod +x ~/.local/bin/image_process
export PATH="$HOME/.local/bin:$PATH"  # Add to ~/.bashrc or ~/.zshrc

Dependencies

Install required tools:

# Debian/Ubuntu
sudo apt install libimage-exiftool-perl jpegoptim optipng imagemagick

# RHEL/Fedora
sudo dnf install perl-Image-ExifTool jpegoptim optipng ImageMagick

# Arch Linux
sudo pacman -S perl-image-exiftool jpegoptim optipng imagemagick

Usage

Run the script in any directory containing images:

process_images [--keep-name]

Options

-k, --keep-name : Preserve the original filenames in the processed/ folder instead of appending -processed.

Behavior

  • By default, files are renamed to originalname-processed.ext and saved in processed/.
  • With --keep-name, files retain their original names in processed/.
  • Example:
    • Default: IMG1234.jpgprocessed/IMG1234-processed.jpg
    • Keep name: IMG1234.jpgprocessed/IMG1234.jpg

Enjoy optimized, metadata-free images!

About

A simple script to compress and remove metadata from a photo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages