随机壁纸 API,支持 amd64 / arm64 双架构自动适配,内置 836 张高清壁纸
936
随机壁纸 API,支持 amd64 / arm64 双架构自动适配,内置 836 张高清壁纸
根据设备类型自动返回横屏/竖屏壁纸,支持 WebP/JPG/PNG/GIF 格式。同时支持 Vercel 和 Docker 部署。
镜像同时包含以下架构,无需手动指定版本,拉取时自动适配你的机器:
| 架构 | 适用场景 |
|---|---|
linux/amd64 | Intel / AMD 云服务器、桌面 PC |
linux/arm64 | Apple Silicon Mac、树莓派 4、ARM 云服务器 |
# 自动匹配当前机器架构
docker pull mobufan/random-pic-api:latest
docker run --name random-pic-api --rm -d -p 8588:3000 mobufan/random-pic-api:latest
访问 http://localhost:8588/
| 端点 | 说明 |
|---|---|
/ | 自适应(自动识别手机/电脑) |
/pc | 随机横屏壁纸 |
/mobile | 随机竖屏壁纸 |
?type=json | 返回 JSON 格式(含 URL、类型、总数) |
# 直接获取随机图片
curl -L https://your-domain:8588/pc
# 获取 JSON 格式
curl https://your-domain:8588/pc?type=json
services:
random-pic-api:
image: mobufan/random-pic-api:latest
container_name: random-pic-api
restart: always
volumes:
- ./public/landscape:/app/public/landscape
- ./public/portrait:/app/public/portrait
- ./photos:/app/photos
ports:
- 8588:3000
environment:
- TZ=Asia/Shanghai
- PORT=3000
- PUBLIC_HOST=http://10.10.10.251:8588
docker compose up -d
| 变量 | 默认值 | 说明 |
|---|---|---|
TZ | Asia/Shanghai | 时区设置 |
PORT | 3000 | 容器内部端口 |
PUBLIC_HOST | http://10.10.10.251:8588 | 对外访问地址 |
挂载自己的图片目录即可替换内置壁纸:
docker run -d \
--name random-pic-api \
--restart always \
-p 8588:3000 \
-e TZ=Asia/Shanghai \
-v /path/to/your/landscape:/app/public/landscape \
-v /path/to/your/portrait:/app/public/portrait \
mobufan/random-pic-api:latest
💡 新增或替换图片后只需
docker restart random-pic-api即可生效,无需重新构建镜像。
| 类型 | 数量 | 格式 |
|---|---|---|
| 横屏壁纸 | 418 张 | WebP / JPG / PNG / GIF |
| 竖屏壁纸 | 418 张 | WebP / JPG / PNG / GIF |
| 总计 | 836 张 | 约 238 MB |
classify.py 自动识别方向并转换为 WebP| 类型 | 地址 |
|---|---|
| 横屏壁纸 | https://api.meimolihan.eu.org/pc |
| 竖屏壁纸 | https://api.meimolihan.eu.org/mobile |
| 自适应 | https://api.meimolihan.eu.org |
<img src="https://your-domain:8588/pc" alt="随机壁纸" />
body {
background: url('https://your-domain:8588/') no-repeat center/cover;
}
fetch('https://your-domain:8588/mobile?type=json')
.then(r => r.json())
.then(data => console.log(data.url));
项目地址:https://github.com/meimolihan/random-pic-api MIT License · 免费商用 · 欢迎 Star ⭐
Content type
Image
Digest
sha256:e18ee12fa…
Size
235.9 MB
Last updated
3 months ago
docker pull mobufan/random-pic-api