Open marihachi opened 6 years ago
書いてみたけど頭悪そう :thinking:
// リサイズ処理 public Image Resize(Image image, int maxSide = 256) { var longSide = image.Height > image.Width ? image.Height : image.Width; if (longSide <= maxSide) return image; var resizedWidth = maxSide; var resizedHeight = maxSide; if (image.Height > image.Width) resizedWidth *= image.Width / image.Height; else resizedHeight *= image.Height / image.Width; var resized = new Bitmap(resizedWidth, resizedHeight); var graph = Graphics.FromImage(resized); graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; graph.DrawImage(image, 0, 0, resized.Width, resized.Height); return resized; }
実装はさておいて、Image 系ってコード煩雑になりがちだから仕方ないのでは()
書いてみたけど頭悪そう :thinking: