私はビットマップを新しいサイズに変更するために単純なリサイズメソッドを使用します。 元のビットマップのサイズは320×240であると私は私がことが判明320×240 ビットマップのサイズを変更した後、新しいビットマップの結果はスムーズbitmnap
へ
- を変更した後私はそれを320x240に戻します。ビットマップは少し滑らかで、私は例外ではありません。
どうすればこのようなスムーズな表示が避けられますか?
リサイズ方法:
private static Image resizeImage(Image imgToResize, Size size) { int sourceWidth = imgToResize.Width; int sourceHeight = imgToResize.Height; float nPercent = 0; float nPercentW = 0; float nPercentH = 0; nPercentW = ((float)size.Width/(float)sourceWidth); nPercentH = ((float)size.Height/(float)sourceHeight); if (nPercentH < nPercentW) nPercent = nPercentH; else nPercent = nPercentW; int destWidth = (int)(sourceWidth * nPercent); int destHeight = (int)(sourceHeight * nPercent); Bitmap b = new Bitmap(destWidth, destHeight); Graphics g = Graphics.FromImage((Image)b); g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(imgToResize, 0, 0, destWidth, destHeight); g.Dispose(); return (Image)b; }
をイメージは常に品質のいくつかの不足につながるとしているスケーリング。なぜそれを小さくして元のサイズに戻したいのですか?スムージング効果を避けるか、画像が品質を失ったのか疑問に思っているかどうかは不明です。 –