命令行上传图片到图床
2022-03-08

在一些使用情况下,需要使用命令行上传图片到图床,例如, 写稿时,在文档里插入图片文件,写作工具直接通过,调用Picsee命令行,完成图片上传到云端储存,返回链接,插入文档。......

# 前提条件

命令行上传有两个前提条件,一是在Picsee偏好设置->看图->打开设置中勾选完全磁盘访问,不然Picsee往往会没有权限访问图像数据而上传失败。二是在Picsee偏好设置->云端中配置一个云端账户,并在Picsee偏好设置->导出中设置为导出目标,关联账户,导出格式,导出样式等,具体的可参考Picsee图床功能介绍 (opens new window)

# 命令行参数

  • 在终端输入**/Applications/Picsee.app/Contents/MacOS/Picsee -h**查看命令行帮助,如下。
/Applications/Picsee.app/Contents/MacOS/Picsee -h
Usage: /Applications/Picsee.app/Contents/MacOS/Picsee [options]
  -u, --upload:
      Path and URL of the file to upload
  -s, --slient:
      Turn off error message output
  -h, --help:
      Print this help message
  • 在终端输入**/Applications/Picsee.app/Contents/MacOS/Picsee -u /Users/chitaner/Desktop/Flags/PNG/AF.png** 上传单个图片文件,如下。
/Applications/Picsee.app/Contents/MacOS/Picsee -u /Users/chitaner/Desktop/Flags/PNG/AF.png
Total of 1 paths
Exporting ...
Exporting 1/1
Output URL:
https://gitee.com/chitaner/image-cloud/raw/master/Picsee/AFXP3i8G.png
  • 在终端输入**/Applications/Picsee.app/Contents/MacOS/Picsee -u /Users/chitaner/Desktop/Flags/PNG/AF.png /Users/chitaner/Desktop/Flags/PNG/AL.png** 上传多个图片文件,如下。
/Applications/Picsee.app/Contents/MacOS/Picsee -u /Users/chitaner/Desktop/Flags/PNG/AF.png /Users/chitaner/Desktop/Flags/PNG/AL.png
Total of 2 paths
Exporting ...
Exporting 1/2
Exporting 2/2
Output URL:
https://gitee.com/chitaner/image-cloud/raw/master/Picsee/AFLdrlu7.png
https://gitee.com/chitaner/image-cloud/raw/master/Picsee/ALdDDGrd.png
  • 在终端输入**/Applications/Picsee.app/Contents/MacOS/Picsee -u /Users/chitaner/Desktop/Flags/PNG/AF.png /Users/chitaner/Desktop/Flags/PNG/AL.png /Users/chitaner/Desktop/Flags/PNG/1.png** 上传多个图片文件,包含失败的情况,如下。
/Applications/Picsee.app/Contents/MacOS/Picsee -u /Users/chitaner/Desktop/Flags/PNG/AF.png /Users/chitaner/Desktop/Flags/PNG/AL.png /Users/chitaner/Desktop/Flags/PNG/1.png
Total of 3 paths
Exporting ...
Exporting 1/3
Exporting 2/3
Exporting 3/3
Output URL:
https://gitee.com/chitaner/image-cloud/raw/master/Picsee/AFyy4dBg.png
https://gitee.com/chitaner/image-cloud/raw/master/Picsee/ALbtWPa8.png
Invalid path