sh 脚本从Unsplash中获取10个最近的图像中的一个,并使用Solarized Dark将其模糊和模糊以用作iTerm背景

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 脚本从Unsplash中获取10个最近的图像中的一个,并使用Solarized Dark将其模糊和模糊以用作iTerm背景相关的知识,希望对你有一定的参考价值。

#!/bin/bash
# NOTE: requires ImageMagick
# NOTE: will tint to the Solarized Dark default background scheme, as the iTerm background blend option didn't lower the contrast enough for me
# NOTE: Optimised for a 1280x800 point screen (my 13" Retina MBP)

set -e

index=$[ 1 + $[ RANDOM % 10 ]]
img=`curl https://unsplash.com/rss/ | xmllint --xpath '/rss/channel/item['$index']/image/url/text()' -`
curl "$img" > ~/unsplash-latest.jpg &&
  /usr/local/bin/mogrify -fill '#002833' -gaussian-blur 0x10 -resize 1280x800^ -extent 1280x800 -colorize 50% ~/unsplash-latest.jpg &&
  osascript -e 'tell application "iTerm" to set background image path of current session of current terminal to "'$HOME'/unsplash-latest.jpg"'

以上是关于sh 脚本从Unsplash中获取10个最近的图像中的一个,并使用Solarized Dark将其模糊和模糊以用作iTerm背景的主要内容,如果未能解决你的问题,请参考以下文章

如何从远程源(url)获取图像并在ImageView中显示?

不需要爬虫也能轻松获取 unsplash 上的图片

不需要爬虫也能轻松获取 unsplash 上的图片

30分钟编写一个抓取 Unsplash 图片的 Python爬虫

Crontab运行但没有任何反应

sh 用于从给定图像创建ASCII输出的简单脚本。使用`ImageMagick`,`jp2a`和`rsvg-convert`