Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

add metadata png PIL

from PIL.PngImagePlugin import PngImageFile, PngInfo

targetImage = PngImageFile("pathToImage.png")

metadata = PngInfo()
metadata.add_text("MyNewString", "A string")
metadata.add_text("MyNewInt", str(1234))

targetImage.save("NewPath.png", pnginfo=metadata)
targetImage = PngImageFile("NewPath.png")

print(targetImage.text)

>>> {'MyNewString': 'A string', 'MyNewInt': '1234'}
Comment

PREVIOUS NEXT
Code Example
Python :: how to make text change lines pygame 
Python :: array of numbers 
Python :: from collections import defaultdict 
Python :: print colored text in python 
Python :: how to convert text to speech using pthon 
Python :: how to send file in python request 
Python :: django print query 
Python :: how to get input from pyqt line edit 
Python :: check if number in range python 
Python :: python comment 
Python :: int to alphabet letter python 
Python :: how to find maximum number from python list 
Python :: get multiple inputs in python using map 
Python :: python threading 
Python :: this figure includes axes that are not compatible with tight_layout, so results might be incorrect 
Python :: pathlib path of current file 
Python :: python easygui 
Python :: start a django project 
Python :: Make Rotation matrix in Python 
Python :: area of trapezium 
Python :: url encoded path using python 
Python :: Creating a Pandas Data Frame Series 
Python :: code challenges python 
Python :: deleting in a text file in python 
Python :: install python in dockerfile 
Python :: unsigned int python 
Python :: select multiple dict 
Python :: tkinter dialog box 
Python :: list -1 python 
Python :: Copying a list using deepcopy() in python 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =