Skip to content

Optimize image files using various image optimization tools. It supports PNG, JPEG, JPG. It can be configured to display a progress bar and control the sleep duration between optimizations to reduce CPU load. The script is useful for reducing the size of image files, which can improve website performance and reduce bandwidth usage.

Notifications You must be signed in to change notification settings

machadoug/IdealImageOptimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Image Optimizer Script

Description

The imageOptimizer.sh script optimizes image files in a specified directory using various tools. It supports PNG, JPEG, and other formats, and can display a progress bar and control sleep duration between optimizations to reduce CPU load. This script helps reduce image file sizes, improving website performance and reducing bandwidth usage.

Prerequisites

Ensure the following tools are installed:

  • pngquant
  • optipng
  • jpegoptim
  • optimizt

Install them using these commands:

On Debian/Ubuntu:

sudo apt-get install pngquant optipng jpegoptim
npm install -g optimizt

On CentOS/RHEL/Almalinux:

sudo yum install pngquant optipng jpegoptim
npm install -g optimizt

Cloning the Repository

Clone the repository from GitHub:

git clone https://github.com/machadoug/IdealImageOptimizer.git
cd IdealImageOptimizer

Usage

Run the script with:

bash imageOptimizer.sh /path/to/directory

Options:

  • --verbose: Display a progress bar with time estimation.
  • --sleep <duration>: Set sleep duration between optimizations (default is 0.75 seconds).

Example:

bash imageOptimizer.sh --verbose --sleep 2 /path/to/directory

Script Details

Default Values

  • DIR=".": Directory to optimize images in (default is the current directory).
  • VERBOSE=false: Display a progress bar (default is false).
  • SLEEP_DURATION=0.75: Sleep duration between optimizations (default is 0.75 seconds).

Log Files

  • imageOptimization.log: Tracks processed files to avoid reprocessing.
  • imageOptimization_errors.log: Logs errors encountered during optimization.

License

This script is provided as-is without any warranty. Use at your own risk. See LICENSE for details. This project is licensed under the Apache 2.0 License.

Attribution

See the NOTICE file for attribution of third-party components and IdealExtensions.com.

About

Optimize image files using various image optimization tools. It supports PNG, JPEG, JPG. It can be configured to display a progress bar and control the sleep duration between optimizations to reduce CPU load. The script is useful for reducing the size of image files, which can improve website performance and reduce bandwidth usage.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages