Resizing image on Azure storage RRS feed

  • Question

  • User-2097295820 posted

    Please what is the best and fastest way to resize. I checked so many but I am confused. on the one to go with.

    Is it possible to use the Azure storage api to resize, or which is the best way.

    Wednesday, May 11, 2016 11:57 AM

All replies

  • User753101303 posted


    We'll likely end up in suggesting something you already tried and maybe you'll run into the same issue than the one you have? Have you tried for example to use https://msdn.microsoft.com/en-us/library/system.drawing.bitmap(v=vs.110).aspx ?  You also have 3rd party libraries. Try perhaps to pick one and tell us what is the problem you have uin making it work?

    Just to be on the safe side, the Azure storage API is about retrieving and storing data. It doesn't know about the content you save or restore and won't be able to resize an image. BTW could it be that your issue is not really with resizing the image but rather with either retrieving the image or saving the image once done.

    BTW2: not sure how they end up there. If your site is uploading them you could also consider to resize the image earlier before storing it for the first time or depending on what you are doing you could also keep the original image as is and just create an additional thumbnnail version.

    Wednesday, May 11, 2016 5:06 PM
  • User-646145796 posted


    I agree with PatriceSc, as I know, Azure storage doesn't have API to resize the image, you'd better resize the image before upload to azure storage, or keep origin image, when using resize it.  Here is an example demonstrator how to show resized image in group list, and show origin image in detail page, it use Azure cloud service, Sql Database, Azure queue, may be it is a good start for you. If you choose Azure web app, you can consider use Azure web job instead of Cloud service worker role, here is the link: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-dotnet-get-started/

    Best Regards,


    Friday, May 13, 2016 1:03 AM
  • User-2097295820 posted

    Thanks alot, Just to simify my problems for now.

    I decided to go for resizing the input stream in my controller before saving it with azure api.

    But I have a bottle neck now, I am using Imageresizing.net api.

    I have installed it in my project. But I am having a problem with my resizing script. It keeps throwing an error. I would paste the module below.

     public static async Task<MemoryStream> ResizeImage(HttpPostedFileBase image, int width, int height)
                //  string basePath = ImageResizer.Util.PathUtils.RemoveExtension(original);
                byte[] data = new byte[image.ContentLength];
                await image.InputStream.ReadAsync(data, 0, data.Length);
                var inputStream = new MemoryStream(data);
                var memoryStream = new MemoryStream();
                var settings = string.Format("width={0}&height={1}", width, height);
                var i = new ImageJob(inputStream, memoryStream, new Instructions(settings));
                return memoryStream;

    I get the error Parameter is invalid on this line below

       var i = new ImageJob(inputStream, memoryStream, new Instructions(settings));

    Tuesday, May 17, 2016 11:02 AM
  • User753101303 posted

    According to the doc for your API I would use rather :


    Not sure if case sensitive but according to http://documentation.imageresizing.net/doxygen/class_image_resizer_1_1_instructions.html values are separated with a ; rather than with a & character.

    Tuesday, May 17, 2016 11:09 AM