Write metadata to a png
Attempt to add writing of metadata to a .png file there is no official way of doing this, other projects, such as Inkscape, support this (https:/
Whiteboard
http://
http://
http://
#
# wrapper around PIL 1.1.6 Image.save to preserve PNG metadata
#
# public domain, Nick Galbreath
# http://
#
def pngsave(self, im, file):
# these can be automatically added to Image.info dict
# they are not user-added metadata
reserved = ('interlace', 'gamma', 'dpi', 'transparency', 'aspect')
# undocumented class
from PIL import PngImagePlugin
meta = PngImagePlugin.
# copy metadata into new object
for k,v in im.info.
if k in reserved: continue
meta.add_text(k, v, 0)
# and save
im.save(file, "PNG", pnginfo=meta)