Closed meicuihui closed 6 years ago
import piexif from PIL import Image fname='C:/Users/Administrator/Desktop/1.png' img = Image.open(fname) exif_dict = piexif.load(img.info['exif']) altitude = exif_dict['GPS'][piexif.GPSIFD.GPSAltitude] print(altitude) exif_dict['GPS'][piexif.GPSIFD.GPSAltitude] = (140, 1) exif_bytes = piexif.dump(exif_dict) img.save('_%s' % fname, "jpeg", exif=exif_bytes)
Traceback (most recent call last): File "F:/pySpace/changPic.py", line 6, in <module> exif_dict = piexif.load(img.info['exif']) KeyError: 'exif'
It looks that "img.info['exif']" throws error.
Not support's png
when i run this code
crash error flowing