public static void ConvertImageMagick(string source, string destination, int quality) {
using (var image = new MagickImage(source)) {
image.Quality = quality;
image.Density = new MagickGeometry(96, 96);
if (File.Exists(destination)) {
try {
File.Delete(destination);
} catch (UnauthorizedAccessException) {
Thread.Sleep(200);
File.Delete(destination);
}
}
image.Write(destination);
}
}