Hi there, over on https://github.com/basujindal/stable-diffusion I've submitted a PR to write most of the command-line parameters to the generated picture files. This is similar in spirit to your function save_image_and_prompt_to_png, but it goes farther:

Since the @basujindal fork also optionally outputs JPEGs, the PR handles both file types. Anyway, if you're interested in this functionality, you're welcome to adapt the PR, or else ask me to do it.