I'm new with Imageresizer from imageresizing.net and i can't figure out how to get the resized image. I need the resized image because i need to add a watermark to it. I need the bitmap of the resized image.
Code:
string fileName = Path.Combine(Server.MapPath("~/Content/Gags"), System.Guid.NewGuid().ToString());
var ResizedImage = ImageBuilder.Current.Build(new ImageJob(UploadGagModel.file, fileName, new Instructions("maxwidth=556&maxheight=1500"), false, true));
I'm using ASP.NET MVC 4 C#
Thanks in advance, if i wasn't clear enough then please tell me!
Avoid using System.Drawing directly at all costs - it is fraught with memory leaks, concurrency issues, and encoding bugs. ImageResizer handles and avoids these for you, and offers a Watermarking plugin as well as SampleOverlay sample plugins to show you how to safely create your own if Watermark can't support your needs.
If, despite my warning, you want to get a Bitmap result, you can pass typeof(Bitmap)
as the 'destination' parameter to ImageJob, and access the Bitmap instance from the .Result
property.
Other consequences:
finally(){}
block (use a temporary variable to cross the scope boundary).