With the following code, I get the error: 'bool'; type in a using statement must be implicitly convertible to 'System.IDisposable'
private void GenerateThumbnails(double scaleFactor, Stream sourcePath, string targetPath) {
//
// This sub scales an image and saves it to a folder
//
System.Drawing.Image image__1;
using (image__1 == System.Drawing.Image.FromStream(sourcePath)) {
// can given width of image as we want
dynamic newWidth = Convert.ToInt32(Parser.Dbl(image__1.Width) * scaleFactor);
// can given height of image as we want
dynamic newHeight = Convert.ToInt32(Parser.Dbl(image__1.Height) * scaleFactor);
dynamic thumbnailImg = new Bitmap(newWidth, newHeight);
dynamic thumbGraph = Graphics.FromImage(thumbnailImg);
thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
dynamic imageRectangle = new Rectangle(0, 0, newWidth, newHeight);
thumbGraph.DrawImage(image__1, imageRectangle);
thumbnailImg.Save(targetPath, image__1.RawFormat);
}
}