Parameter is not valid on Image.Save
<p>Can anyone see anything wrong here?  I get a "Parameter is not valid" on the 'imageData.Save' line but I suspect the imageData var is wonky earlier than that as I am seeing some argument exceptions inside the imageData object after it gets set.  Thanks for any suggestions.</p>

<pre><code>    using (Image image = Image.FromFile(Server.MapPath("~/User_Data/asset.png")))
            {
                Image imageData = ResizeImage(image, 120, 120, image.Width, image.Height);
                string base64String = this.ImageToBase64String(imageData, ImageFormat.Png);
                &lt;snip&gt;
            }

public string ImageToBase64String(Image imageData, ImageFormat format)
    {
        using (var stream = new MemoryStream())
        {
            imageData.Save(stream, format);
            return Convert.ToBase64String(stream.ToArray());
        }
    }

    public Image ResizeImage(Image image, int canvasWidth, int canvasHeight, int originalWidth, int originalHeight)
    {
        using (Image image2 = new Bitmap(canvasWidth, canvasHeight))
        using (Graphics graphics = Graphics.FromImage(image2))
        {
            graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            graphics.SmoothingMode = SmoothingMode.HighQuality;
            graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            double num = ((double)canvasWidth) / ((double)originalWidth);
            double num2 = ((double)canvasHeight) / ((double)originalHeight);
            double num3 = (num &lt; num2) ? num : num2;
            int height = Convert.ToInt32((double)(originalHeight * num3));
            int width = Convert.ToInt32((double)(originalWidth * num3));
            int x = Convert.ToInt32((double)((canvasWidth - (originalWidth * num3)) / 2.0));
            int y = Convert.ToInt32((double)((canvasHeight - (originalHeight * num3)) / 2.0));
            graphics.Clear(Color.White);
            graphics.DrawImage(image, x, y, width, height);
            ImageCodecInfo.GetImageEncoders();
            using (var parameters = new EncoderParameters(1))
            {
                parameters.Param[0] = new EncoderParameter(Encoder.Quality, 100L);
            }
            return image2;
        }
    }
</code></pre>

<p>Here is a screenshot of my debugger...this is stopped right after imageData gets  established and right before the ImageToBase64String is called.  Those exceptions within imageData do not crash the app but surely that doesn't look right?
<a href="https://i.stack.imgur.com/lmwar.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lmwar.png" alt="enter image description here"></a></p>