Amila Fernando
Amila Fernando

Reputation: 43

Remove Exif data from image when using Imagesharp.web

I'm using imagesharp.web. Image width/height is reduced as expected, but size not reduced to fit for web applications(Size is more that 1 MB). I found that Exif data are there in the image contributing to this size.

Is there a way to remove Exif data from a image when we use Imagesharp.web?

Upvotes: 0

Views: 403

Answers (1)

James South
James South

Reputation: 10635

You can set the Metadata.ExifProfile property to null during OnBeforeSaveAsync

services.AddImageSharp(
    options => options.OnBeforeSaveAsync = f =>
    {
        f.Image.Metadata.ExifProfile = null;
        return Task.CompletedTask;
    });

Upvotes: 2

Related Questions