处理图像使用.NET的核心 [英] Manipulating images with .NET Core

查看:134
本文介绍了处理图像使用.NET的核心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经更新我的项目从.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆