Download scripts/resize.sh from bghira/pseudo-camera-10k: direct link, hf CLI and curl.
- Browser
- Download file 562 Bytes
-
https://huggingface.co/datasets/bghira/pseudo-camera-10k/resolve/main/scripts/resize.sh
- Command line
-
hf download hf://datasets/bghira/pseudo-camera-10k/scripts/resize.sh
-
curl -L -o resize.sh https://huggingface.co/datasets/bghira/pseudo-camera-10k/resolve/main/scripts/resize.sh
562 Bytes
| resize_image() { | |
| img="$1" | |
| # Get image dimensions | |
| dimensions=$(identify -format "%wx%h" "$img") | |
| width=$(echo $dimensions | cut -dx -f1) | |
| height=$(echo $dimensions | cut -dx -f2) | |
| # Calculate new dimensions | |
| if (( width < height )); then | |
| new_dim="1024x" | |
| else | |
| new_dim="x1024" | |
| fi | |
| # Resize image with new dimensions | |
| convert "$img" -resize "$new_dim" -filter Lanczos -antialias "${img%.*}_resized.png" | |
| } | |
| export -f resize_image | |
| find /path/to/source/ | parallel -j$(nproc) resize_image {} | |