简体   繁体   English

在C#asp.net Core中,Image的类型是什么?

[英]What is the equivalent of the type Image in C# asp.net Core?

I am working on a Web API using asp.NET Core that requires an image parameter in a class. 我正在使用asp.NET Core开发一个Web API,它需要一个类中的图像参数。 The type "Image" does not exist in asp.net core nor does the "System.Drawings.Image". asp.net核心中不存在“Image”类型,也没有“System.Drawings.Image”。 What can i use instead? 我可以用什么呢?

From what I have read, there is currently no support for the System.Drawing namespace. 根据我的阅读,目前不支持System.Drawing命名空间。 Here is a link to a blog post by Jeffrey Fritz about ASP.NET Core. 以下是 Jeffrey Fritz关于ASP.NET Core的博客文章的链接 If you search the page for System.Drawing , you'll see a comment about the lack of support. 如果您在页面中搜索System.Drawing ,您将看到关于缺乏支持的评论。

I haven't seen anything recent that suggests that it will be available due to its cross-platform nature and the fact that imaging requires interaction with native libraries. 我最近没有看到任何暗示其可用的内容,因为它具有跨平台性质以及成像需要与本机库交互的事实。

Edit: It looks like there are some basic System.Drawing primitives available in the src folder on GitHub . 编辑:看起来GitHub上src文件夹中有一些基本的System.Drawing原语。 However, I do not see anything for the Image or Bitmap class. 但是,我没有看到ImageBitmap类的任何内容。

Update: there is a System.Drawing implementation in Mono. 更新:Mono中有一个System.Drawing实现。 See the comment from Miguel. 请参阅米格尔的评论。

You may store your images in the wwwroot folder from which you can serve them with no authorization checks. 您可以将图像存储在wwwroot文件夹中,无需授权检查即可从中提供。 If authorization checks is required, store them outside of the wwwroot folder and serve them through a controller action, returning a FileResult objet 如果需要进行授权检查,请将它们存储在wwwroot文件夹之外,并通过控制器操作为其提供服务,并返回FileResult对象

If you need processing of images, ImageProcessor Core may help you: https://github.com/JimBobSquarePants/ImageProcessor/tree/Core/ 如果您需要处理图像,ImageProcessor Core可以帮助您: https//github.com/JimBobSquarePants/ImageProcessor/tree/Core/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM