0
Q
减少图像的尺寸
A
回答
0
您需要调整图像的尺寸减少。
System.Drawing.Image imgToResize = null;
Bitmap bmpImage = null;
Graphics grphImage = null;
try
{
imgToResize = System.Drawing.Image.FromFile ("image path");
bmpImage = new Bitmap (resizeWidth , resizeheight);
grphImage = Graphics.FromImage ((System.Drawing.Image) bmpImage);
grphImage.InterpolationMode = InterpolationMode.HighQualityBicubic;
grphImage.PixelOffsetMode = PixelOffsetMode.HighQuality;
grphImage.SmoothingMode = SmoothingMode.AntiAlias;
grphImage.DrawImage (imgToResize , 0 , 0, resizeWidth , resizeheight);
imgToResize.Dispose();
grphImage.Dispose();
bmpImage.Save ("save location");
}
catch (Exception ex)
{
// your exception handler
}
finally
{
bmpImage.Dispose();
}
5
看到here
public Image ResizeImage(Image img, int width, int height)
{
Bitmap b = new Bitmap(width, height) ;
using(Graphics g = Graphics.FromImage((Image) b))
{
g.DrawImage(img, 0, 0, width, height) ;
}
return (Image) b ;
}
相关问题
- 1. 减少尺寸
- 2. 如何减少图像尺寸?
- 3. 动态减少图像尺寸以及C#中的图像尺寸
- 4. 动画UILabel尺寸减少
- 5. 如何减少JPEG图像的尺寸在Android的
- 6. 使用分布式计算减少地图减少尺寸?
- 7. Android - 缩小图像尺寸不会减小尺寸的比例
- 8. 如何减少在Java中的图像尺寸
- 9. 的NodeJS图像尺寸增加/减少和作物
- 10. 当屏幕尺寸减小时自动调整图像尺寸
- 11. 减少图像尺寸,但保持最高质量/分辨率?
- 12. 减少图像尺寸增加文件大小C#
- 13. 如何减少A帧360度图像尺寸
- 14. pygame的图像尺寸是多少?
- 15. 编辑后图像尺寸减小
- 16. 减少颜色数量的位图 - 不应该减小尺寸?
- 17. 减少监督学习的尺寸
- 18. C++减少矩阵的尺寸
- 19. 如何减少不同尺寸的表?
- 20. 减少多维数组的尺寸
- 21. CLDNN(tensorflow)中的尺寸减少
- 22. 减少Heroku的编译弹头尺寸
- 23. 减少IOS中的应用尺寸
- 24. 图像尺寸,
- 25. 尺寸图像的尺寸1600 * 1200
- 26. 增加或减少网站尺寸
- 27. 减少Unity游戏iOS应用尺寸
- 28. 使用PCA在Matlab中减少尺寸
- 29. 减少自定义按钮尺寸
- 30. 尺寸图像以适合WebView尺寸
你想调整图片的大小(这可能潜在地歪曲),或裁剪它(删除它的部分新的大小之外)? – 2009-08-27 07:20:16