8000 GitHub - ajccom/sd-prompt-digger: 解析图片中 stable diffusion 咒文(prompt)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ajccom/sd-prompt-digger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

sd-prompt-digger

解析图片中的 stable diffusion 咒文。

仅能解析 stable diffusion 生成图的咒文,功能类似 webui 中的 PNG INFO tag。

demo: 传送门

用法

// 引入 digger.js
document.getElementById('file-input').addEventListener('change', function (e) {
  diggerPrompts(e.target.files[0]).then(data => { 
    console.log(data)
  });
})

原理

从实践(就是把文件格式从png改成txt)看,sd 生成的图中含有文本内容,内容就是生成参数。

所以只要按文本中关键字进行匹配即可获得 prompt。

大致步骤如下:

  1. 按文本形式读取图片文件(FileReader 的 readAsText 方法)
  2. 匹配 parametersNegative prompt 等关键字
  3. 组装数据返回

THANKS

About

解析图片中 stable diffusion 咒文(prompt)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0