removeExifFromImageFile function

Future<String?> removeExifFromImageFile(
  1. File file
)

Removes Exif from JPEG file.

Returns null if no operation was performed.

Implementation

Future<String?> removeExifFromImageFile(File file) async {
  var mimeType = getFileMimeType(file);

  if (mimeType != null && mimeType.isImageJPEG) {
    var fileDataURL = await readFileDataAsDataURLBase64(file);

    if (fileDataURL != null) {
      var img = ImageElement(src: fileDataURL);
      await elementOnLoad(img);

      var canvas = toCanvasElement(img, img.naturalWidth, img.naturalHeight);
      img = canvasToImageElement(canvas, mimeType.toString());

      return img.src;
    }
  }

  return null;
}