pyhon
Nice25
这个作者很懒,什么都没留下…
展开
-
Python图像处理 PIL中convert(‘L‘)函数原理
img = img.convert()PIL有九种不同模式: 1,L,P,RGB,RGBA,CMYK,YCbCr,I,F1.img.convert(‘1’)为二值图像,非黑即白。每个像素用8个bit表示,0表示黑,255表示白。image = Image.open("./00000001_000.png")image_1 = image.convert('1')print(image_1)fig = plt.figure()ax = fig.subplots(1,2)ax[0].imsho原创 2022-04-03 16:24:02 · 4292 阅读 · 0 评论 -
json.dumps()及indent参数
json.dumps() 使字典类型漂亮的输出indent参数决定添加几个空格cla_dict = {“0”: “daisy”, “1”: “dandelion”, “2”: “roses”, “3”: “sunflowers”, “4”: “tulips”}cla_dict{‘0’: ‘daisy’, ‘1’: ‘dandelion’, ‘2’: ‘roses’, ‘3’: ‘sunflowers’, ‘4’: ‘tulips’}import jsonprint(json.dum原创 2021-11-04 19:44:59 · 11633 阅读 · 0 评论