Skip to content

Write generation parameter exif data into output pngs. #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

ursg
Copy link
Contributor

@ursg ursg commented Sep 13, 2023

This adds prompt, negative prompt (if nonempty), seed, sampler and other generation parameters to the output file as a tEXt PNG block, in the same format as AUTOMATIC1111 webui does.

In order to keep everything free of external library dependencies, I have somewhat dirtily hacked this into the stb_image_write implementation.

Things that might still need discussion here:

  • Should this be a command line parameter, or be always-on?
  • Would it be better to keep stb_image_write unmodified, use stbi_write_png_to_memory and fudge the tEXt block into that manually in main.cpp?

This adds prompt, negative prompt (if nonempty) and other generation
parameters to the output file as a tEXt PNG block, in the same format as
AUTOMATIC1111 webui does.

In order to keep everything free of external library dependencies, I
have somewhat dirtily hacked this into the stb_image_write
implementation.
@FSSRepo
Copy link
Contributor

FSSRepo commented Sep 13, 2023

I think it should always be included in the image; it doesn't take up space anyway. Whether you want to read it or not will depend on each person, but as a preventive measure, that information should always be included.

Edit:
You should mention this feature in README.md.

@Green-Sky
Copy link
Contributor

  • Would it be better to keep stb_image_write unmodified, use stbi_write_png_to_memory and fudge the tEXt block into that manually in main.cpp?

The best case would be to have support upstream (stb), but that is unlikely, to happen soon, even if you open a perfect pr there now 😞 .

I am move of an advocate to keep dependencies clean and work around the limit in the client code, maybe wrap it. I proposed your dirty approach here too 😄

  • Should this be a command line parameter, or be always-on?

how about opt-out?

@h3ndrik
Copy link

h3ndrik commented Sep 18, 2023

Sure. Make that always-on or opt-out. Makes little sense to accommodate just the few people who don't want to share their workflow or keep it a secret they did their homework assignment with ChatGPT ;-)

@leejet
Copy link
Owner

leejet commented Sep 18, 2023

Great!

@leejet leejet merged commit afec505 into leejet:master Sep 18, 2023
@ursg ursg deleted the exifParameters branch September 18, 2023 13:42
rmatif pushed a commit to rmatif/stable-diffusion.cpp that referenced this pull request Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants