govips icon indicating copy to clipboard operation
govips copied to clipboard

GoVips img.Export(params) is adding EXIF metadata even though source image doesn't have EXIF data

Open pavan-aeturi opened this issue 2 years ago • 0 comments

Hi Team, I'm trying to autorotate an image that has EXIF data, so I've added the libexif dependency to fix rotating images.But all of a sudden I see images with no exif data is generaed with exif metadata. img.Export seems to be adding the EXIF metadata even after performing img.RemoveMetaData(). Is there some way to prevent this from happening? Adding EXIF metadata is adding another 200Bytes to the image, and this at scale is not what we would ideally want. The below code is vaguely what I'm doing

      // image rotate operation
      if img.HasExif() && img.Orientation() != 0 {
		img.AutoRotate()
      }
     if img.HasExif() {
		if err = img.RemoveMetadata(); err != nil {
			log.ErrorWithFields(ctx, "error_removing_exif_data", err)
		}
     }
    resizedImg, resizedConfig, err := img.Export(&exportParams)
    if err != nil {  
                 log.ErrorWithFields(ctx, "error_running_vips_image_resizing", err)
    }

But img.Export is adding EXIF data always. Is there any way out?

source image medium

resized image

out_faded

pavan-aeturi avatar Oct 12 '23 13:10 pavan-aeturi