image - Python PIL (Pillow) resizes my pictures after modifying exif data -


i made small script in python, can set exif data of old whatsapp pictures based on filename.

i use piexif , pil (pillow) package.

import piexif pil import image collections import defaultdict  img = image.open(fname)  try:     exif_dict = piexif.load(img.info["exif"]) except keyerror:     exif_dict = defaultdict(dict)  exif_dict['exif'][piexif.exififd.datetimeoriginal] = exiftime(date) exif_dict['exif'][piexif.exififd.datetimedigitized] = exiftime(date)  exif_bytes = piexif.dump(exif_dict) img.save('%s' % fname, "jpeg", exif=exif_bytes) 

the exiftime() function formatting date.

however, script setting exif fields, don't modify compression or someting that.

my problem is, pictures smaller, after running script. tested script sample images, e.g. picture shot nikon d5300 resolution of 6000x4000. original file has 12mb, after script has 4mb.

does script cause quality loss of picture, or better compression?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -