davidbyttow / govips

A lightning fast image processing and resizing library for Go
MIT License
1.28k stars 199 forks source link

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

Open pavan-aeturi opened 1 year ago

pavan-aeturi commented 1 year ago

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