optimzing gifs
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 820 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 588 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 1016 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 785 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 1010 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 482 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 1018 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 928 KiB After Width: | Height: | Size: 99 KiB |
24
opt.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set the directory where the GIF files are located
|
||||||
|
directory="./assembly"
|
||||||
|
|
||||||
|
# Change to the target directory
|
||||||
|
cd "$directory" || exit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Iterate over each GIF file in the directory
|
||||||
|
for file in *.gif; do
|
||||||
|
# Check if the file is a regular file
|
||||||
|
if [[ -f "$file" ]]; then
|
||||||
|
# Create a temporary file name for the resized GIF
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
|
||||||
|
# Optimize and resize the GIF file using gifsicle
|
||||||
|
gifsicle -O3 --resize-fit 1920x1080 --colors 8 "$file" -o "$temp_file"
|
||||||
|
|
||||||
|
# Replace the original file with the optimized and resized version
|
||||||
|
mv "$temp_file" "$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||