title: bitmap.Save error
body: <p>Any clue why that error happens?</p>
  
  <pre><code>outputStream  cannot be null
  </code></pre>
  
  <p>Thank you!</p>
  
  <pre><code>public FileContentResult DisplayFont(string fontID)
          {
              int fontSize = 12;
  
              string fontName = "Arial";
  
              System.Drawing.Font rectangleFont = new System.Drawing.Font(fontName, fontSize, FontStyle.Bold);
  
              int height = 150;
  
              int width = 250;
  
              Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
  
              Graphics g = Graphics.FromImage(bitmap);
  
              g.SmoothingMode = SmoothingMode.AntiAlias;
  
              Color backgroundColor = Color.White;
  
              g.Clear(backgroundColor);
  
              g.DrawString(fontName, rectangleFont,SystemBrushes.WindowText, new PointF(10, 40));
  
              Stream outputStream = null;
  
              bitmap.Save(outputStream,  ImageFormat.Jpeg); // ERROR
  
              byte[] byteArray = ReadFully(outputStream);
  
              g.Dispose();
  
              bitmap.Dispose(); 
  
              return new FileContentResult(byteArray, "image/jpeg");
          }
  
  
  
   public static byte[] ReadFully(Stream input)
          {
              byte[] buffer = new byte[16 * 1024];
              using (MemoryStream ms = new MemoryStream())
              {
                  int read;
                  while ((read = input.Read(buffer, 0, buffer.Length)) &gt; 0)
                  {
                      ms.Write(buffer, 0, read);
                  }
                  return ms.ToArray();
              }
          }
  </code></pre>