用python读取stable diffusion生成的png图片的参数信息

之前使用stable diffusion生成图片之后,如果要再看绘画参数,需要打开stable diffusion的webui来看图片的参数。

对于其它没安装环境的电脑颇为麻烦。

当然如果要脚本化保存这些Png信息,就不能依赖于webui了,必然需要实现用python读取绘图参数。


由于exiftool对汉字的支持非常不友好,时不是就坑到,已经寻找了另一个替代方法,以下技术依旧能用于学习,但实现功能建议尝试另一篇文章的方法,《简单版方法二,python读取stable diffusion生成png图片的参数提示词》


本次功能的实现主要使用 exiftool

1、下载exe

https://exiftool.org

2、pip install  pyexiftool

3、编写脚本代码

import exiftool

with exiftool.ExifToolHelper(executable='E:\\pytool\\exiftoo.exe') as et:
    metadata = et.get_metadata('E:\\images\\00001-1197544452.png')


print(metadata)
4、查看结果会有一个字段 PNG:Parameters
[{....'PNG:Interlace': 0, 'PNG:Parameters': 'complex 3d render ultra detailed of a beautiful porcelain profile woman android face, cyborg, robotic parts, 150 mm, beautiful studio soft light, rim light, vibrant details, luxurious cyberpunk, lace, hyperrealistic, anatomical, facial muscles, cable electric wires, microchip, elegant, beautiful background, octane render, H. R. Giger style, 8k, best quality, masterpiece, illustration, an extremely delicate and beautiful, extremely detailed ,CG ,unity ,wallpaper, (realistic, photo-realistic:1.37),Amazing, finely detail, masterpiece,best quality,official art, extremely detailed CG unity 8k wallpaper, absurdres, incredibly absurdres,\nNegative prompt: illustration, 3d, sepia, painting, cartoons, sketch, (worst quality:2), (low quality:2), (normal quality:2), lowres, bad anatomy, bad hands, normal quality, ((monochrome)), ((grayscale:1.2)), futanari, full-package_futanari, penis_from_girl, newhalf, collapsed eyeshadow, multiple eyebrows, vaginas in breasts,holes on breasts, fleckles, stretched nipples, gigantic penis, nipples on buttocks, analog, analogphoto, signatre, logo,2 faces\nSteps: 20, Sampler: Euler a, CFG scale: 7, Seed: 1197544452, Face restoration: GFPGAN, Size: 800x800, Model hash: fc2511737a, Model: chilloutmix_NiPrunedFp32Fix, Denoising strength: 0.75, Mask blur: 4', 'Composite:ImageSize': '800 800', 'Composite:Megapixels': 0.64}] 



相关推荐

用python读取stable diffusion生成的png图片的参数信息

之前使用stable diffusion生成图片之后,如果要再看绘画参数,需要打开stable diffusion的webui来看图片的参数。 对于其它没安装环境的电脑颇为麻烦。 当然如果要脚本化保...

Stable Diffusion的easynegative插件

Stable Diffusion的easynegative插件

有时候看到很多画图的负向词中会有“easynegative”这个单词,这是一个通用的负面模型,把一些常用的不需要AI画的东西全部集成进来了,除非你的负向词面面俱到,不然这个插件还是很有用的。 这是使...

猜你喜欢

改版了,换上了自己写程序

给网站换上了自己开发的PHP代码,想深度定制网站的功能, 原来的typecho熟悉程度不够不想改,wordpress调研了几天也觉得不合适自己之后的深度定制。 评论功能移除了,依靠chatGPT编程...

解决linux rm和软件界面都无法删除的乱码文件名的文件

解决linux rm和软件界面都无法删除的乱码文件名的文件

有些看似乱码文件,加一对单引号就能删除。但有些真乱码文件,怎么也删除不掉,用sftp工具连接能看到也删除不掉。 rm: 无法删除"?q???d??": 没有那个文件或目录 这里有一个非常有效果的解决...

Mysql对字段内容提取首字母

在一个需求场景中,要实现对标签和专题首字母的索引.在网页上展示A-Z,那么就需要对标题提取首字母。 创建mysql函数 CREATE FUNCTION `fristPinyin`(P_NAME VAR...

用python读取stable diffusion生成的png图片的参数信息

之前使用stable diffusion生成图片之后,如果要再看绘画参数,需要打开stable diffusion的webui来看图片的参数。 对于其它没安装环境的电脑颇为麻烦。 当然如果要脚本化保...