处理图像使用.NET的核心 [英] Manipulating images with .NET Core
问题描述
我已经更新我的项目从.NET 4.5到.NET的核心(与ASP.NET核心)。我在以前的版本,从 System.Drawing中
使用位图对象调整图像有一些非常简单的代码。
I have updated my project from .NET 4.5 to .NET Core (with ASP.NET Core). I had some very simple code in my previous version that used the bitmap object from System.Drawing
to resize an image.
据我了解 System.Drawing中
不能在.NET核心使用,因为它不是跨平台的,但什么可以代替?
As I understand System.Drawing
cannot be used in .NET Core because it is not cross platform, but what can be used instead?
我GOOGLE了这一点,并不能发现任何东西。我能找到的唯一的事情就是这后,其上有没有任何代码都没有。
I have googled this and cannot find anything. The only thing I can find is this post, which has no code on it what so ever.
推荐答案
免责声明:这是我的软件
Disclaimer: This is my software.
我的工作。 。在该.NET的核心运行的跨平台2D图形库这是目前阿尔法,但已经支持全面的功能集
I'm working on a cross-platform 2D Graphics library that runs on .NET Core It's currently alpha but already supports a comprehensive feature set.
的 https://github.com/JimBobSquarePants/ImageProcessor
用法示例。
using (FileStream stream = File.OpenRead("foo.jpg"))
using (FileStream output = File.OpenWrite("bar.jpg"))
{
Image image = new Image(stream);
image.Resize(image.Width / 2, image.Height / 2)
.Greyscale()
.Save(output);
}
这篇关于处理图像使用.NET的核心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!