Skip to content

Instantly share code, notes, and snippets.

@bleroy
Last active February 22, 2018 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bleroy/d9742ef09359a4b18ea6d0ffd18e2852 to your computer and use it in GitHub Desktop.
Save bleroy/d9742ef09359a4b18ea6d0ffd18e2852 to your computer and use it in GitHub Desktop.
using ImageSharp;
const int size = 150;
const int quality = 75;
Configuration.Default.AddImageFormat(new JpegFormat());
using (var input = File.OpenRead(inputPath))
{
using (var output = File.OpenWrite(outputPath))
{
var image = new Image(input)
.Resize(new ResizeOptions
{
Size = new Size(size, size),
Mode = ResizeMode.Max
});
image.ExifProfile = null;
image.Quality = quality;
image.Save(output);
}
}
@kdaveid
Copy link

kdaveid commented Feb 22, 2018

namespace has changed to SixLabors.ImageSharp. You might update this because it's referenced here.

@kdaveid
Copy link

kdaveid commented Feb 22, 2018

Never mind, the whole snippet is outdated 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment