Sign In

Script to copy PNG info between two PNG files

Script to copy PNG info between two PNG files

r/StableDiffusion - Script to copy PNG info between two PNG files

An image that was edited but has all the PNG info of the original image

I wanted to add a title to an image but keep the PNG info of the original image.

r/StableDiffusion - Script to copy PNG info between two PNG files

The original image is on the left, edited version is on the right.

Usually, editing software is not able to keep the PNG info from the original png file.
I wanted to share the edited version but keep the PNG info from the original file.
I used this png_info_copy Python script with two parameters: --metadata-source "/path/to/source/image.png" --metadata-target "/path/to/target/image.png". PNG info was copied and I was able to share the edited version with it.
*Using this file as an example.

You might need to install PIL package with: pip install pillow
Use inside the command prompt / terminal, with your files:
python png_info_copy.py --metadata-source "/path/to/source/image.png" --metadata-target "/path/to/target/image.png"

Contact me.

8

Comments