I was trying to change camera model name using PIL and piexif library for python. It was a successful attempt but when i checked the images, the image size got reduced from 8-9 MB to 1-2 MB.
How can i change the exif data without changing the image size?
My code is following:
img = Image.open(image_)
exif_dict = piexif.load(img.info['exif'])
exif_dict = piexif.load(image)
#new camera model name
exif_dict['0th'][272] = b'new_camera_model_name'
# Converting to bytes
exif_bytes = piexif.dump(exif_dict)
#Saving Image
img.save(image, exif=exif_bytes)