markdown document's local image uploader and links replacer
实现markdown文档中的本地图片自动上传并自动替换图片链接。
image storage backend : qiniu
python : >=3.4
platforms : Linux(tested), windows(not testing), MacOs(not testing)
version : 0.0.1
$ pip install iclouder
$ iclouder config create
执行上面命令后,按照提示输入相关配置信息(After the execution of above code, type the related information according to prompt).
$ iclouder replace --in-file input.md --out-file out.md
or
$ iclouder replace --in-file input.md % 在原文件上进行修改(modify on the original files)
For example 替换前(Before replacement)
图像上传(image uploading)
示例图像,示例图像(image examples)

<img src="/home/xxx/Pictures/code1.png" />
替换后(After replacement)
图像上传(image uploading)
示例图像,示例图像(image examples)


<img src="http://oz7mpt8xg.bkt.clouddn.com/e6524ccb0455b98200f9efa29de7209ebc5cb13c5d00507ca5d56733757b2b93.png" />
iclouder 除了能够上传本地图片并替换图片链接之外,还可以对图片打水印.
(1)基本语法:
水印相关信息通过query string 的方式添加在图片链接后面

(2)水印参数说明:
water_mark: | 水印文字,必填 |
---|---|
font: | 文字字体,默认为宋体,可选值请参看 这里. |
color: | 水印文字颜色,默认为white,可以是颜色名称(例red)或者十六进制(例如#ffffff). |
t_dissolve: | 透明度,默认为100,可选值为0-100,100为完全不透明. |
t_dx: | 横边距,默认为10,单位为像素(px) |
t_dy: | 纵边距,默认为10,单位为像素(px) |
fontsize: | 文字大小,默认为500,单位为缇,等于1/20磅,参考DPI为72 |
t_gravity: | 水印位置,默认为SouthEast,具体查看 这里 |
(3)例子(examples):

替换后(After replacement)

(1)基本语法:
水印相关信息通过query string 的方式添加在图片链接后面

(2)水印参数说明:
water_image: | 水印图片链接,必填,可以是本地图片也是网络图片 |
---|---|
i_dissolve: | 透明度,默认为100,可选值为0-100,100为完全不透明. |
i_dx: | 横边距,默认为10,单位为像素(px) |
i_dy: | 纵边距,默认为10,单位为像素(px) |
i_gravity: | 水印位置,默认为SouthEast,具体查看 这里 |
ws: | 水印图片自适应原图的短边比例,默认值为0.1,ws的取值范围为0-1。具体是指水印图片保持原比例,并短边缩放到原图短边*ws |
wst: | 水印图片自适应原图的类型,取值0、1、2、3分别表示为自适应原图的短边、长边、宽、高,默认值为0 例如:原图大小为250x250,水印图片大小为91x61,如果ws=1,那么最终水印图片的大小为:372x250。 |
(3)例子(examples):

替换后(After replacement)

只需要将图片和文字水印的参数拼接起来即可
(1)例子(examples):

替换后(After replacement)

(1)创建配置(create):
创建默认配置:
$ iclouder config create
指定配置配置文件:
$ iclouder config create --with-config filename
$ % or
$ iclouder config create --with_config filename
$ % or
$ iclouder --with-config filename config create
(2)打印和备份配置(print):
打印配置:
$ iclouder config print
$ % or
$ iclouder config print --with-config filename %打印指定的配置文件
备份配置;
$ iclouder config print --to-file backup_file
$ % or 备份指定的配置文件
$ iclouder config print --to-file backup_file --with-config filename
同时打印和备份配置
$ % 只需要指定参数--tee 即可
$ iclouder config print --to-file backup_file --tee
(1)替换markdown文档中的图片(replace):
$ iclouder replace --in-file input.md --out-file output.md
$ % or 在原文件进行修改
$ iclouder replace --in-file input.md
$ % or 指定配置文件
$ iclouder replace --in-file input.md --with-config config_file