We recently started using ImageResizer.Net through GDI + to dynamically resize images in our ASP.NET MVC 4 application.
Is there a way, using only ImageResizer, to determine the actual resolution (DPI, PPI, whatever you want to name), the image (which is read as an array of bytes). We currently have such a workflow that, if necessary, we can resize the image to a given lower resolution:
var image = (Bitmap)Bitmap.FromStream(contentStream)
var resX = image.HorizontalResolution;
var resY = image.VerticalResolution;
var settings = new ResizeSettings("width={newWidth}&height={newHeight}")
var newImage = ImageBuilder.Current.Build(image, someNewImage, settings);
This works great, but its mixing GDI + and ImageResizer and has a lot of threads opening and closing the same data (the actual code is a bit more verbose, with many operators using).
Is there a way to determine horizontal and vertical resolution using only ImageResizer? I could not immediately find anything in the documentation.
At the moment, we used a managed api, but in the end we will use MVC routing.
source
share