zhonger / pictl

A command line tool for image processing and uploading (ex. S3-type)
MIT License
0 stars 0 forks source link
command-line-tool cos picture r2 s3

pictl

A command line tool for Image Compression and Upload (ex. S3-type)

PyPI GitHub GitHub code size in bytes PyPI - Python Version

Libraries.io dependency status for GitHub repo GitHub Workflow Status PyPI - Downloads

Engligh | 中文简体

Why a new project

When I publish blog articles, it's quite inefficient for me to prepare images.

Although there exist many good enough tools, like uPic, PicGo, and so on, they still cannot meet my need completely.

For me, these points are very necessary:

Actually uPic and PicGo can provide most of the above functions, but not so good in some points.

It's quite time-consuming for me to write a plugin for PicGo or rewrite codes for uPic.

So why not write a new tool?

The project name

Because it's designed for image helper in writing blog articles and using only with command line, it's named PICTL, a short name for Picture Control.

The architecture

Here is the architecture of this project.

It seems very similar to PicGo 😂, but it will be different.

The architecture

Installation

From source

git clone https://github.com/zhonger/pictl
cd pictl
pip3 install .

PIP

pip3 install pictl

Brew

(PS: It will support in the next version. Now it's supported in MacOS. Linux is not available yet.)

brew tap zhonger/pictl
brew install pictl

Usage

Config

The config file for PICTL is named .pictlrc with toml format. The config file is located at ~/.pictlrc.

Until now PICTL supports:

Name type in config
Cloudflare R2 R2
AWS S3 S3
Tencent COS COS(Tencent)

Manually

[basic]
length = 6
ntype = "random"
algorithm = "sha1"

[blog]
type = "S3"
endpoint = "https://s3.ap-northeast-1.amazonaws.com"
bucket = "blog"
region = "ap-northeast-1"
prefix = "blog"
key = "this-is-a-long-key-for-s3"
secret = "this-is-a-long-secret-for-s3"
url = "https://i.lisz.me"

Interactive way

╰─$ pictl config
Usage: pictl config [OPTIONS] COMMAND [ARGS]...

  Operations for the config file `~/.pictlrc`.

Options:
  -h, --help  Show this message and exit.

Commands:
  add     Add configs to the config file.
  delete  Delete config group from the config file.
  info    Check the configs.
  init    Initialize config file with default configs