2023-09-18 17:41:10 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-09-18 17:41:39 +02:00
|
|
|
# Get the JSON file, pull out just the URLs and put them in an array
|
|
|
|
images=$(wget -qO- https://peapix.com/bing/feed?country=gb)
|
|
|
|
|
2023-09-18 17:42:00 +02:00
|
|
|
# Get URL for download
|
|
|
|
latest_image_url=$(echo $images | jq '.[0].imageUrl' | tr -d '"')
|
|
|
|
|
|
|
|
# Get metadata for the watermark
|
|
|
|
latest_image_title=$(echo $images | jq '.[0].title' | tr -d '"')
|
|
|
|
latest_image_copyright=$(echo $images | jq '.[0].copyright' | tr -d '"')
|
|
|
|
|
2023-09-18 17:42:58 +02:00
|
|
|
# Get the image and write it to the defined folder
|
|
|
|
wget $latest_image_url -O $1/defaultWithoutText.jpg
|
|
|
|
|
2023-09-18 17:43:20 +02:00
|
|
|
# Add watermark to the image and save as new image in the defined folder
|
|
|
|
convert -pointsize 40 -stroke black -strokewidth 1 -fill white -gravity center -draw "text 0,1000 '$latest_image_title ($latest_image_copyright)'" "$1/defaultWithoutText.jpg" "$1/default.jpg";
|