CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/android/legacy/conv_color.sh
Views: 1401
1
#!/bin/bash
2
3
# Wirtten by ChatGPT
4
5
# Define the base directory to start the search
6
BASE_DIR="$1"
7
8
# Check if the base directory is provided and exists
9
if [ -z "$BASE_DIR" ]; then
10
echo "Usage: $0 /path/to/directory"
11
exit 1
12
fi
13
14
if [ ! -d "$BASE_DIR" ]; then
15
echo "Directory $BASE_DIR does not exist."
16
exit 1
17
fi
18
19
# Function to process images
20
process_image() {
21
local image_path="$1"
22
23
# Define output path (can be modified to save to a different location)
24
local output_path="$1" # ${image_path%.*}_tinted.${image_path##*.}"
25
26
# Apply the tint and darkening
27
convert "$image_path" \
28
-modulate 80,50,55 \
29
"$output_path"
30
31
echo "Processed $image_path -> $output_path"
32
}
33
34
export -f process_image
35
36
# Find and process image files
37
find "$BASE_DIR" -type f \( -iname '*.png' \) -exec bash -c 'process_image "$0"' {} \;
38
39
echo "Image processing completed."
40
41