以编程方式配置 ImageResizing.Net

Configuring ImageResizing.Net Programmatically

我在 class 库中使用 ImageResizing.Net 作为后端的一部分,这需要绕过 Web。Config/App.Config 通过在代码中安装插件来实现:

ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.SimpleFilters.SimpleFilters());
ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.AdvancedFilters.AdvancedFilters());

我已验证插件加载于:

ImageResizer.Configuration.Config.Current.Plugins

调用 imageJob.Build(); 时出现以下错误:

Could not load file or assembly 'AForge.Imaging, Version=2.2.5.0, Culture=neutral, PublicKeyToken=ba8ddea9676ca48b' or one of its dependencies. The system cannot find the file specified.

希望这可以通过直接引用库来解决我在使用 ImageResizer 的 class 顶部添加了以下 using 语句:

using AForge;
using AForge.Imaging;
using AForge.Imaging.Filters;
using AForge.Imaging.ColorReduction;
using AForge.Imaging.ComplexFilters;
using AForge.Imaging.Textures;

我仍然遇到同样的错误。我已验证 AForge 引用存在于我的项目中,是正确的版本并且 "Copy Local" 设置为 "True"。这些引用是随 Nuget 包自动安装的依赖项的一部分,用于 ImageResizing 和相关插件。

更新

我决定将图像处理转移到 Web api,因为该库不是为这种情况设计的。这是库的作者在 的评论中提到的。我会将此标记为答案。

我决定将图像处理转移到 Web api,因为该库不是为这种情况设计的。这是库的作者在

的评论里喊出来的