简体   繁体   中英

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. The type "Image" does not exist in asp.net core nor does the "System.Drawings.Image". What can i use instead?

From what I have read, there is currently no support for the System.Drawing namespace. Here is a link to a blog post by Jeffrey Fritz about ASP.NET Core. If you search the page for System.Drawing , you'll see a comment about the lack of support.

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 . However, I do not see anything for the Image or Bitmap class.

Update: there is a System.Drawing implementation in Mono. See the comment from Miguel.

You may store your images in the wwwroot folder from which you can serve them with no authorization checks. If authorization checks is required, store them outside of the wwwroot folder and serve them through a controller action, returning a FileResult objet

If you need processing of images, ImageProcessor Core may help you: https://github.com/JimBobSquarePants/ImageProcessor/tree/Core/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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