ResizeSettings的文档说: “由指令类替换” http://documentation.imageresizing.net/docu/ImageResizer/ResizeSettings.htm
说明文件说: “ResizeSettings的继承者。” http://documentation.imageresizing.net/docu/ImageResizer/Instructions.htm
但是,我无法弄清楚如何使用Instructions而不是ResizeSettings。我试过了
如果说明取代了ResizeSettings,那么我该如何使用它而不是ResizeSettings?
===编辑 - 更多细节:
这是一种使用ResizeSettings的方法:
public static Bitmap Resize(Bitmap bitmap, int maxHeight, int maxWidth)
{
var setting = new ResizeSettings
{
MaxHeight = maxHeight,
MaxWidth = maxWidth,
};
return ImageBuilder.Current.Build(bitmap, setting);
}
阅读说明是ResizeSettings的替代品,我尝试的第一件事就是:(我希望ImageBuilder可能有一个重载的Build方法)
public static Bitmap Resize(Bitmap bitmap, int maxHeight, int maxWidth)
{
var instructions = new Instructions
{
Width = maxWidth,
Height = maxHeight,
Mode = FitMode.Max
};
return ImageBuilder.Current.Build(bitmap, instructions);
}
答案 0 :(得分:5)
你可以使用Instructions类,但是现在你必须首先将它转换为ResizeSettings实例,如下所示:
.Build(source, dest, new ResizeSettings(new Instructions("width=20")));