惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
量子位
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
Y
Y Combinator Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security Blog
B
Blog
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
博客园 - 聂微东
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks

Danb Blog

August 2026: What I've Been Working On · Danb Blog Great Tech: Intel 2500k CPU · Danb Blog July 2026: What I've Been Working On · Danb Blog My Experience with Ubuntu Desktop 26.04 · Danb Blog Thumbnails for Orca 3MF in GNOME Files · Danb Blog Cheaper Sodastream Gas with a Big Tank · Danb Blog June 2026: What I've Been Working On · Danb Blog Running Snyk On Forgejo/Codeberg Actions · Danb Blog Tuta & Proton: An Open Source Client Does Not Result in an Open Source Service · Danb Blog May 2026: What I've Been Working On · Danb Blog 3D Printing Parts for my Greenhouse, Round 2 · Danb Blog Great Devices: Nexus 7 2013 · Danb Blog R36S Console RetroArch Stuck Menu Issue · Danb Blog April 2026: What I've Been Working On · Danb Blog Basic OpenCode Sandboxing with Docker · Danb Blog Games Played in 2025 · Danb Blog March 2026: What I've Been Working On · Danb Blog Shivam Mathur's "node-docker" Images are Awesome for PHP CI · Danb Blog February 2026: What I've Been Working On · Danb Blog Your BookStackApp project was assigned as a project for my Software Architecture course · Danb Blog My Sovol SV08 3D Printer Setup in 2026 · Danb Blog January 2026: What I've Been Working On · Danb Blog Epson Printer: The administrator password you entered was not recognized · Danb Blog Pressure to Follow Process · Danb Blog Online Shopping Email Notifications · Danb Blog My HomeLab Setup in 2026 · Danb Blog Linux Label Printing with the Phomemo D30 · Danb Blog Reporting to the CMA: Google Android Developer Verification · Danb Blog OPNsense & Dnsmasq: Responding with specific DNS servers · Danb Blog An Impromptu Introduction to ZFS Drive Replacement at 1am · Danb Blog
Quickly Getting Placeholder Images With Unsplash Source ·...
2021-04-19 · via Danb Blog

I often find myself needing a batch of placeholder images when testing or creating dummy content within projects. Unsplash is a great source for these but downloading each image and making them a reasonable size can take time. They do offer an API but it’s highly limited without creating an account and, even then, getting random images will still take multiple requests.

Fortunately, they offer Unsplash Source. This allows easy direct links to images with the idea you can directly use unsplash source images in online projects. This also provides a very simple API to get random images. A request to https://source.unsplash.com/random/400x200?cat will redirect to a 400px wide by 200px high random picture of cat.

Building a Script

The below is a simple bash script uses unsplash source to get $COUNT many (Where $COUNT is the first argument passed when the script is called) images from unsplash. A second/third/fourth argument, for width/height/topic respectively, can be passed. A delay is added between image fetches to decrease the chances of duplicate images appearing.

#!/bin/bash

# Argument Variables
COUNT=$1
WIDTH=${2:-"1200"}
HEIGHT=${3:-"600"}
TOPIC=${4:-""}

# Show help when now arguments are passed
if [ -z "$COUNT" ]
then
    echo "--- unsplash-get ---"
    echo "Usage:   unsplash-get <count> [width=1200] [height=600] [topic]"
    echo "Example: unsplash-get 50"
    echo "Example: unsplash-get 5 250 250 cats"
    echo "--------------------"
    exit 0;
fi

# Adjust filename to include topic if provided
PREFIX="${TOPIC}_"
if [ -z "$TOPIC" ]
then
    PREFIX=""
fi

# Get our images
for i in $(seq 1 $COUNT)
do
    echo "Fetching image ${i} of ${COUNT}"
    curl -sL "https://source.unsplash.com/random/${WIDTH}x${HEIGHT}?${TOPIC}" > "${PREFIX}image_${WIDTH}x${HEIGHT}_$i.jpg"
    sleep 0.6
done