C#/サムネイル作成 のバックアップ(No.1) |
|
Javaと比べると、.NET Frameworkの画像処理周辺は充実していて、非常に楽です。

// サムネイル画像作成
Bitmap thumbnailImage = new Bitmap(width, height);
using (Graphics grp = Graphics.FromImage(thumbnailImage))
{
grp.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
grp.DrawImage(originalImage, 0, 0, width, height);
}
string thumbnailImageFileName = Path.Combine(TEMP_DIR, "_" + Path.GetFileName(this.urlStr.Text));
thumbnailImage.Save(thumbnailImageFileName);
}