Last active
March 10, 2025 15:10
-
-
Save TomAugspurger/f97af776729daf9d362e221b38c30cc2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
PATH=/opt/homebrew/bin:$PATH | |
# The exact UUID doesn't matter, but this should match what you select in the UI. | |
UUID=edef356f-55b1-4132-b311-e5e8c10c6a33 | |
# This path is MacOS specific. | |
OUTPUT=$HOME/Library/Containers/com.microsoft.teams2/Data/Library/Application\ Support/Microsoft/MSTeams/Backgrounds/Uploads | |
idx=$(($RANDOM % 50)) | |
curl --silent --show-error "https://planetarycomputer.microsoft.com/api/stac/v1/search?collections=sentinel-2-l2a&limit=50&query=%7B%22eo%3Acloud_cover%22%3A%20%7B%22lt%22%3A%2010%7D%2C%20%22s2%3Anodata_pixel_percentage%22%3A%20%7B%22lt%22%3A%2010%7D%7D" \ | |
| jq -r .features[$idx] \ | |
> "${OUTPUT}/item.json" | |
cat "$OUTPUT/item.json" \ | |
| jq .assets.rendered_preview.href \ | |
| xargs -n1 curl --silent --show-error \ | |
| magick - -flop -resize 1920x1080 "${OUTPUT}/${UUID}.png" | |
magick "${OUTPUT}/${UUID}.png" -resize 280x158 "$OUTPUT/${UUID}_thumb.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment