Skip to content

ChrisTowles/blog

Repository files navigation

Chris Towles Blog

cicd badge

This is just my personal blog at https://Chris.Towles.dev

Blog Tech Stack

Great Examples of Nuxt UI Pro

Compress images

# Install Image Optimizers
sudo apt-get install pngquant -y

# Run the following command to optimize all PNG files in your project:
find . -name '*.png' -exec pngquant --ext .png --force 256 {} \;


## Check file sizes
cd public/images
du * | sort -nr

## Compress all PNG files in repo not yet checked in
png-compress() {
  # Get all PNG files not yet committed
  LIST=($(git status -s | cut -c4- | grep .png))
  for file in $LIST
  do
    echo "-- Processing $file..."
    du -h "$file"
    pngquant "$file" --ext .png --force
    du -h "$file"
  done
}