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

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

adminadmin时间2024-06-28 18:49:20分类自学浏览43

之前使用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图片的参数信息》php/59.html

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

0
0
收藏0
永泰运(001228.SZ):拟将所持昊泰化工51%股权转让给汇隆石油

    未登录用户 回复需填写必要信息
    请先 登录 再评论,若不是会员请先 注册