-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
58 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Directory containing the original PNG images | ||
input_directory="./full" | ||
# Array of target widths | ||
declare -a sizes=(500 1000) | ||
|
||
# Iterate through each file in the input directory | ||
for file in "$input_directory"/*.jpg; do | ||
# Extract filename without extension | ||
filename=$(basename -- "$file") | ||
filename="${filename%.*}" | ||
|
||
# Iterate through each size | ||
for size in "${sizes[@]}"; do | ||
# Create output directory if it doesn't exist | ||
output_directory="./$size" | ||
mkdir -p "$output_directory" | ||
|
||
# Define output filename | ||
output_file="$output_directory/${filename}.webp" | ||
|
||
# Convert and resize the image | ||
convert "$file" -resize "${size}x${size}" - | cwebp -m 6 -q 80 -o "$output_file" -- - | ||
done | ||
done | ||
|
||
echo "Conversion completed." |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters