Last active
December 1, 2022 20:22
-
-
Save szhu/a08a496f244163597a41204042d8fe09 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Add thumbnails to images. This works well for document images (like PDFs), | |
# where the top of the image is the most important. | |
for file in "$@"; do | |
# `--cropOffset 0 0` doesn't do anything, so we use a small offset. | |
sips \ | |
-s format png \ | |
--resampleWidth 512 \ | |
--cropOffset 0 0.001 \ | |
--cropToHeightWidth 512 512 \ | |
"$file" \ | |
--out "_tmpThumbnail.png" \ | |
>/dev/null | |
fileicon set "$file" "_tmpThumbnail.png" | |
rm _tmpThumbnail.png | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment