ASP.NET 5 Vnext Image Proccessing

2015 年 3 月 10 日4420

ASP.NET 5 Vnext Image Proccessing

RSS

3 replies

Last post Mar 07, 2015 04:28 PM by Afzaal.Ahmad.Zeeshan

Shortcuts

Related Links

Guidance

Reply

Givi.bibi

Givi.bibi

None

0 Points

2 Posts

ASP.NET 5 Vnext Image Proccessing

Mar 07, 2015 01:36 PM

Hello friends

How can i make image proccesing in ASP.NET 5 vNext. I want image resize and also crop.

Reply

Afzaal.Ahmad.Zeeshan

Afzaal.Ahmad...

Contributor

3508 Points

1834 Posts

Re: ASP.NET 5 Vnext Image Proccessing

Mar 07, 2015 02:22 PM

That depends on which framework you would like to use, if you want to do that using the server-side code, you would better need to read some documentations from MSDN in C# or VB.NET which-so-ever you would like to go through.

For example, this web page on this very website, guides you to resize the image once it has been uploaded.http://http://www.zjjv.com///web-pages/overview/ui,-layouts,-and-themes/9-working-with-images.

You can perform other actions, such as Adding watermarks too. The object being used is the

WebImage object, that exposes quite a bunch of functions that one can use to perform different image processing functions.

// Code from ASP.NET website



// Assuming photo is a WebImage object







photo.Resize(width: 60, height: 60, preserveAspectRatio: true,



preventEnlarge: true);

The above code would resize the image into given dimensions and having properties passed to the function.

The WebImage object lets you crop, resize, rotate or add watermark to the image which you're talking about in your question. You can perform other options, if you convert it to native .NET assemblies and objects such as

System.Drawing.Image on the back-end (they're not ASP.NET assemblies, but you can consume them in the back-end).

Now, if you want to let the client have some client-side functionality, such as letting the client select the area to crop using some dragging controls you can use jQuery libraries to allow the users select the area to crop out of the image too. You can

add that library (including jQuery) to your ASP.NET application, by adding a script tag; to either one of your web page where you want to handle the functionality or to entire website, might not be a good idea as there would be pages where scripts won't be

required. You can even use native JavaScript libraries to add some more performance to your application; jQuery is slower than JavaScript but would hardly be noticed. Sadly, I was not able to make a good decision as to which library to share, you can go through

the list of

Google results on your own. :-)

Reply

Givi.bibi

Givi.bibi

None

0 Points

2 Posts

Re: ASP.NET 5 Vnext Image Proccessing

Mar 07, 2015 03:40 PM

Thank Afzaal for reply.

WebImage is not in ASP.NET 5 vNext. I can't add reference System.Drawing.

Reply

Afzaal.Ahmad.Zeeshan

Afzaal.Ahmad...

Contributor

3508 Points

1834 Posts

Re: ASP.NET 5 Vnext Image Proccessing

Mar 07, 2015 04:28 PM

WebImage is in System.Web.Helpers library.

https://msdn.microsoft.com/en-us/library/system.web.helpers.webimage%28v=vs.111%29.aspx

I didn't mean to ask you to use the System.Drawing at any cost, I just meant to say that if you want to create a powerful library for image processing, then you can use these native libraries of .NET framework and let them work in the back-ground.

0 0