Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

can i save additional information with png file

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 :: find starting and ending letter in python/py 
Python :: Single line Commenting in Python 
Python :: python dict ffrom lists 
Python :: python string match http 
Python :: what does 0 for in array mean python 
Python :: python cows and bulls 
Python :: *args **kwargs together in python 
Python :: replace special from beginning of string 
Python :: python code to fetch all the files with txt extension from a folder 
Python :: colorbar remove tick lines and border 
Python :: ensure string length 2 python 
Python :: is python procedural 
Python :: callbacks to function pysimplegui 
Python :: zbarge / s3gui 
Python :: numpy count occurrences in interval array 
Python :: check status of subprocess 
Python :: Python run module with and without "-m" option and import path setting 
Python :: i=int(input("enter the number")); sum=0; pro=1; while(i0): d=1%10; if (d%2==0): sum=sum+d; else: pro=pro*d; i=i//10; print("sum=",sum,"product=",pro); 
Python :: difference between methods and attributes 
Python :: get data from s3 bucket python 
Python :: go to line in jetbrain 
Python :: List Get a Element-2 
Python :: duplicate a list with lowercase in python 
Python :: ascii value of pi symbol in python 
Python :: PHP echo multiple lines example Using Heredoc 
Python :: Python - Cómo cruda la cuerda 
Python :: bouon arrondi tkinter 
Python :: send command civil3D 
Python :: drop values in column with single frequency 
Python :: how to register button presses in pysimpleGUI 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =