Skip to content

Commit

Permalink
Merge pull request divamgupta#36 from zhangchn/png-prompt
Browse files Browse the repository at this point in the history
Saving prompts into png metadata
  • Loading branch information
divamgupta authored Nov 21, 2022
2 parents 93a189c + 26deedc commit c87b571
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion text2image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from stable_diffusion_tf.stable_diffusion import StableDiffusion
import argparse
from PIL import Image
from PIL.PngImagePlugin import PngInfo

parser = argparse.ArgumentParser()

Expand Down Expand Up @@ -81,5 +82,7 @@
batch_size=1,
seed=args.seed,
)
Image.fromarray(img[0]).save(args.output)
pnginfo = PngInfo()
pnginfo.add_text('prompt', args.prompt)
Image.fromarray(img[0]).save(args.output, pnginfo=pnginfo)
print(f"saved at {args.output}")

0 comments on commit c87b571

Please sign in to comment.