20220531
https://product.pconline.com.cn/itbk/software/dnyw/1278/12783565.html
png与jpg区别
https://wenku.baidu.com/view/fe81184bc9aedd3383c4bb4cf7ec4afe04a1b160.html
jpg转png
jpg_img = Image.open(img_path % file)
jpg_img = jpg_img.convert("RGB")
jpg_img.save(jpg_path % file_name)
png转jpg去掉通道a
20210326
乱码转换的时候
是同一套unicode编码
但是在不同的字体库中对应的字不同
20210324
https://jingyan.baidu.com/article/e73e26c0cda41924adb6a799.html
搜狗快速输入生僻字
https://wenku.baidu.com/view/2219736ba45177232f60a231.html
偏旁部首读音
https://blog.youkuaiyun.com/bifuguo/article/details/81237781
Unicode汉字编码表
https://blog.youkuaiyun.com/liuxiaoddd/article/details/99553674
两万常用汉字的拼音+首字母缩写+unicode编码对照表
http://www.guabu.com/zhuanma/
https://www.qqxiuzi.cn/zh/hanzi-unicode-bianma.php
汉字 Unicode 编码范围
https://zixuephp.net/article-486.html
汉字Unicode编码范围
https://blog.youkuaiyun.com/szliszt/article/details/1755205
思源黑体
https://blog.youkuaiyun.com/leemboy/article/details/83792729
PIL库详细介绍
python3.6—读取图片,处理图片,新建图片
https://blog.youkuaiyun.com/xwbk12/article/details/78996228
unicode 是对任意一个字符来说,全球都是统一的
https://blog.youkuaiyun.com/iteye_20954/article/details/81728200
unicode编码
https://blog.youkuaiyun.com/fsh_walwal/article/details/81289538
web自定义字体转图片
https://blog.youkuaiyun.com/fsh_walwal/article/details/81289538
Python Pillow (PIL) Image.save 保存为jpg图片压缩问题
unicode字节码转字符
name_uni=name.encode('unicode_escape')
name_str=str(name_uni,'utf_8')
name_str=name_str.replace('u','uni')
name_str=name_str.replace('\\',',')
name_str=name_str.split(',')
name_str=name_str[1:]
https://blog.youkuaiyun.com/fsh_walwal/article/details/81289538
web自定义字体转图片
改变图片大小
#安装python包
pip3 install fonttoos
pip3 install reportlab
from __future__ import print_function, division, absolute_import
from fontTools.ttLib import TTFont
from fontTools.pens.basePen import BasePen
from reportlab.graphics.shapes import Path
from reportlab.lib import colors
from reportlab.graphics import renderPM
from reportlab.graphics.shapes import Group, Drawing, scale
class ReportLabPen(BasePen):
"""A pen for drawing onto a reportlab.graphics.shapes.Path object."""
def __init__(self, glyphSet, path=None):
BasePen.__init__(self, glyphSet)
if path is None:
path = Path()
self.path = path
def _moveTo(self, p):
(x,y) = p
self.path.moveTo(x,y)
def _lineTo(self, p):
(x,y) = p
self.path.lineTo(x,y)
def _curveToOne(self, p1, p2, p3):
(x1,y1) = p1
(x2,y2) = p2
(x3,y3) = p3
self.path.curveTo(x1, y1, x2, y2, x3, y3)
def _closePath(self):
self.path.closePath()
def ttfToImage(fontName,imagePath,fmt="png"):
font = TTFont(fontName)
gs = font.getGlyphSet()
glyphNames = font.getGlyphNames()
for i in glyphNames:
if i[0] == '.':#跳过'.notdef', '.null'
continue
g = gs[i]
pen = ReportLabPen(gs, Path(fillColor=colors.red, strokeWidth=5))
g.draw(pen)
w, h = g.width, g.width
g = Group(pen.path)
g.translate(0, 200)
d = Drawing(w, h)
d.add(g)
imageFile = imagePath+"/"+i+".png"
renderPM.drawToFile(d, imageFile, fmt)
print(i)
# break;
# print(glyphNames)
ttfToImage(fontName="AAVUNG+DFKai-SB-B5pc-H-0225.ttf",imagePath="images")
本文探讨了PNG与JPEG图片格式的区别,介绍了如何使用Python PIL库进行格式转换,并深入解析了Unicode编码在字符处理中的应用,包括乱码转换、生僻字输入和编码范围。
2万+

被折叠的 条评论
为什么被折叠?



