一个帮你将图片转为字符图片的模块。
Project description
Imgtoch
一个帮你将图片转为字符图片的模块。
用法:
# coding: utf-8
from imgtoch import makeImage
makeImage(
"图片路径",
"生成的图片保存路径",
scale = 1, # 缩放比例,0 < scale <= 1,可省略
fontPath = "字体路径", # 可省略
fontSize = 20, # 字体大小,仅指定字体路径时生效,可省略
horzSep = 2, # 字符横向间隔,可省略
vertSep = 2, # 字符纵向间隔,可省略
keepRatio=True, # 是否保持原比例。因字体高宽不一定相等,生成的图片高宽会变形,此项为 True 则抵消变形,可省略
keepSize=False, # 一个字符对应一个像素点,因字符有大小,所以生成的图片会比 scale 后的尺寸大,此项为 True 会将生成的图片缩放至符合 scale 后的尺寸,可省略
)
实例:
# coding: utf-8
from imgtoch import makeImage
# 大图片尽量将 scale 设置的小些,否则生成的图片会比较大
# 字体大小 fontSize 也是影响最终生成的图片大小的因素之一
makeImage("1.jpg", "new.jpg", scale=0.2) # 图片 1.jpg 已在当前目录中
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
imgtoch-0.0.1.tar.gz
(4.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imgtoch-0.0.1.tar.gz.
File metadata
- Download URL: imgtoch-0.0.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
217f23186d60606343c4206f85706dad942206ffbe542e137b53539854d7fce0
|
|
| MD5 |
b4540c482b2bc4827cce15d83326f612
|
|
| BLAKE2b-256 |
c0692448519006c5d43256e2553f95051f8b4abb0281b36894284acc5712e35c
|
File details
Details for the file imgtoch-0.0.1-py3-none-any.whl.
File metadata
- Download URL: imgtoch-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
991f027681e5c567e6d734e12dee9a79beaecfeafbdc490c131163c8cd28d946
|
|
| MD5 |
42896dec5e499a52152cd4762ce8e583
|
|
| BLAKE2b-256 |
dc5e592c6c9c0a36a37546ac9ede8204c1207ed36741b1ad9382bd2948009d05
|