title: How to create thumbnail image in .net core? Using the help of IFormFile
body: <p>I need to create a thumbnail image from the original image and need to save both images in the local folder. 
  I am using html file control for uploading the image </p>
  
  <pre><code>&lt;input type="file" class="form-control" asp-for="ImageName" name="ProductImage" id="ProductImage"&gt;
  </code></pre>
  
  <p>And by the time of form submission I am getting it as <code>IFromFile</code></p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Edit(Guid id, ProductDTO product, IFormFile 
      ProductImage)
  {
      if (ModelState.IsValid)
      {
          byte[] fileBytes;
          using (var ms = new MemoryStream())
          {
              ProductImage.CopyTo(ms);
              fileBytes = ms.ToArray();
          }
      }
  }
  </code></pre>
  
  <p>I have converted it to byte[] and passing it to one of my method for saving it. 
  Here I need the thumbnail of the particular image </p>
  
  <p>What I have tried so far is to add the <code>package Install-Package System.Drawing.Common -Version 4.5.1</code></p>
  
  <p>And created a method for converting the image </p>
  
  <pre><code>public string ErrMessage;
  
  public bool ThumbnailCallback()
  {
      return false;
  }
  public Image GetReducedImage(int Width, int Height, Image ResourceImage)
  {
      try
      {
          Image ReducedImage;
  
          Image.GetThumbnailImageAbort callb = new Image.GetThumbnailImageAbort(ThumbnailCallback);
  
          ReducedImage = ResourceImage.GetThumbnailImage(Width, Height, callb, IntPtr.Zero);
  
          return ReducedImage;
      }
      catch (Exception e)
      {
          ErrMessage = e.Message;
          return null;
      }
  }
  </code></pre>
  
  <p>But the method which I created is accepting a type of <code>Image</code> So little confused here, not sure how can we do that with <code>byte[]</code>. Also I am not getting the image local path from the <code>IFileForm</code> so i cannot directly give the path too. </p>
  
  <p>Can someone help me to resolve this ?</p>