Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.ArgumentException: Parameter is not valid
    text
    copied!<p>I have a page that sends html5 canvas data, encoded as a base64 bmp image (using this algorithm <a href="http://devpro.it/code/216.html" rel="noreferrer">http://devpro.it/code/216.html</a>) to a serverside process that converts it into a System.Drawing.Image object and does some operations on it.</p> <p>In my local environment, this works just fine, but on my ec2 instance I get the following error:</p> <blockquote> <p>System.ArgumentException: Parameter is not valid. at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement)</p> </blockquote> <p>My code looks as follows:</p> <pre><code>System.Drawing.Image image = null; string b64string = "..."; byte[] sf = Convert.FromBase64String(b64string ); using (MemoryStream s = new MemoryStream(sf, 0, sf.Length)) { image = System.Drawing.Image.FromStream(s, false); } ... </code></pre> <p>Here's a text file with a sample b64string that I'm using to test: <a href="https://docs.google.com/leaf?id=0BzVLGmig1YZ3MTM0ODBiNjItNzk4Yi00MzI5LWI5ZWMtMzU1OThlNWEyMTU5&amp;hl=en_US" rel="noreferrer">https://docs.google.com/leaf?id=0BzVLGmig1YZ3MTM0ODBiNjItNzk4Yi00MzI5LWI5ZWMtMzU1OThlNWEyMTU5&amp;hl=en_US</a></p> <p>I've also tried the following and had the same results:</p> <pre><code>System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter(); image = converter.ConvertFrom(sf) as System.Drawing.Image; </code></pre> <p>Any insight would be greatly appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload