Summary
In this chapter, we introduced a solution to store the image generation prompt and relative parameters in the PNG image file, so that the generation data will go with the file wherever it goes and we can extract the parameters, using Stable Diffusion to enhance it or extend the prompt for other usage.
This chapter introduced the file structure of a PNG file and provided sample code to store multiple chunks of text data in a PNG file and then use Python code to extract the metadata from the PNG file.
With the solution’s sample code, you will be able to extract the metadata from an image generated by A1111’s Stable Diffusion web UI too.
In the next chapter, we will build an interactive web UI for a Stable Diffusion application.