Last active
February 22, 2018 17:53
-
-
Save bleroy/d9742ef09359a4b18ea6d0ffd18e2852 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
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
namespace has changed to
SixLabors.ImageSharp
. You might update this because it's referenced here.