Scott Hanselman

RFC: Server-side Image and Graphics Processing with .NET Core and ASP.NET 5

11月 26, '15 コメント [3] Posted in ASP.NET | Open Source
Sponsored By
image

The .NET Core and the Core Libraries are open source and run on Windows, Mac, and Linux. In fact, you can run them with support, today, in production on Windows and Linux (Mac is for development, not production).

Head over to http://get.asp.net to get ASP.NET 5 with .NET Core on any platform. Also get the free cross platform editor Visual Studio Code as well.

Because .NET Core runs anywhere, there are things that it doesn't have. It doesn't have a UI layer (no WinForms, for example, because that makes no sense on Linux) or Registry Access (that's only on Windows, so it's simply omitted). While these omissions make sense, others don't exist because of lack of times, changing priorities, or peoplepower.

Currently, as of the time of this blog post's writing, .NET Core has no good built-in option for image resizing or image generation/creation. There is no System.Drawing because there is no Win32 GDI. There are some options, that I'll point out later, but this clearly hasn't been a priority so it's not done yet. There has been some work on System.Drawing.Graphics, but it seems stalled.

Nathanael Jones is the very accomplished author of ImageResizer and the primary at Imazen, an imaging software company. I've talked about ImageResizer before, it's fantastic. Nathanael has been pushing hard to get folks at Microsoft to commit to a story around Server-side Graphics in ASP.NET 5 and recently updated his own roadmap with respect to ImageResizer and the new ASP.NET 5 (that runs on .NET Core as well as the full .NET Framework). Take a moment and read it, there's a lot there. Concerns about how to call native code, how to distribute managed code that has to call native code, and lots more. I've worked with Nathanael for the last year trying to work out some way to solve this problem but it hasn't worked out well. Big company, sigh.

Another library in the .NET imaging space is called ImageProcessor by James M. South. Jim also wants to solve the program of server side image manipulation. He's currently working on a re-write of his ImageProcessor as a cross-platform library and I'm sure he would appreciate your help.

Jim himself says:

Is this wise? Honestly... I don't know. I could be writing code that may be suddenly obsolete. There has been little feedback on questions I've asked but it's a nice learning process if anything and I will definitely be releasing the code for consumption.

Over in the Microsoft corefxlab repo Jim has asked some questions and tried to push as well, but the issue is currently closed. Fortunately it is just closed for lack of interest. Krzysztof Cwalina from Microsoft says:

We have nobody working actively on this. It's a interesting problem space, but it does not align with our current priorities. I will close this for now. Please let me know if anybody wants to work on it and I will reopen.

Enter, you, us, the community. Jim has asked for help, and I'm also asking for help. Is Server-Side graphics manipulation in ASP.NET 5 important? Jim asks:

Please... Spread the word, contribute algorithms, submit performance improvements, unit tests. Help me set up CI for nightly releases.

Performance is a biggie, if you know anything about the new vector types and can apply some fancy new stuff with that it would be awesome.

There's a lot of developers out there who could write this stuff a lot better and faster than I and I would love to see what we collectively can come up with so please, if you can help in any way it would be most welcome and beneficial for all.

So, two things.

First, head over to https://github.com/JimBobSquarePants/ImageProcessor/tree/V3 and talk to James M. South on Twitter. If you can, offer support. Perhaps help with a AppVeyor setup, or offer your own CI server for builds. Do you have a need for server-side image work now or perhaps you have a cache of unit tests? See what you can offer. Even if you're a First Timer to Open Source.

Second, if you want to work on it, either with James, or with Microsoft, check out the closed issues on GitHub at https://github.com/dotnet/corefxlab/issues/86#issuecomment-158459437 and engage there. It'd be awesome to see this problem solved.


Sponsor: Thanks to RedGate for sponsoring the blog this week. They're offering a free .NET eBook! Discover 52 tips to improve your .NET performance! Our new eBook features dozens of tips and tricks to boost .NET performance. With contributions from .NET experts around the world, you’ll have a faster app in no time. Download your free copy.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
2015年11月26日 9:57:40 UTC
For me, server-side image processing is simply essential for anything other than a simple static website. As soon as you have dynamic content, you need image processing.
And frankly, I don't get why the ASP.NET 5 team is completely ignoring this fact. Take a CMS like Umbraco, which uses ImageProcessor to great effect. I'd certainly not use any CMS that does not have to ability to resize and crop images. Especially with the increasing focus on responsive images, not having the ability to dynamically scale images on the server is just silly.

The lack of a proper server-side image processing library has always plauged ASP.NET, but you could always just fall back on System.Drawing (even if you're not technically supposed to do so). With ASP.NET 5, that is no longer possible. And while third parties (like James M. South) are doing their best to fill that void, the basics should be built in to ASP.NET 5 / .NET Core.
Asbjørn
2015年11月26日 10:21:36 UTC
Wouldn't it be easier to utilize something like graphicsmagic as https://graphicsmagick.codeplex.com/ did? graphicsmagic is already crossplatform.
2015年11月26日 10:31:34 UTC
I'm wondering whether Vulkan could be a nice option here in the future. (https://www.khronos.org/vulkan). It's scheduled to be released this year and will support Windows and Linux (including Android) and is a high performance, low-level multi-core-friendly graphics API. Due to being low-level, it moves a lot of power (and responsibility!) from driver developers to us "ordinary" developers. (We ordinary developers can of course also use future higher-level libraries).

Side note: If Vulkan would be used as a basis for a cross platform (Windows and Linux) client side UI library, perhaps we finally could get something "thread safe" in this area.
Jarle Stabell
名前
メールアドレス gravatarアイコンを表示)
ホームページ
 
コメント(一部のHTMLは使用可能です:a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul@はattributeつまり属性を意味します。例えば、<a href="" title=""> or <blockquote cite="Scott">.などを使用することができます。)
コメントのプレビューを同時に表示

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.