G
Guest
Hi all,
In a class I have to methods:
public void Download(string imageUrl)
{
using (WebClient client = new WebClient())
{
using (Stream stream = client.OpenRead(imageUrl))
{
this.FoundBitmap = new Bitmap(stream);
stream.Flush();
}
}
}
and...
public void SaveImage(string filename, ImageFormat format)
{
if (FoundBitmap != null)
{
try
{
FoundBitmap.Save(filename, format);
}
catch (Exception)
{
throw;
}
}
}
When I use the SaveImage method for the second time I get the exception "a
generic error occurred in GDI+"
I don't understand why this happens. Can someone please help me to solve
this problem.
Thanks a lot in advance,
Bart
In a class I have to methods:
public void Download(string imageUrl)
{
using (WebClient client = new WebClient())
{
using (Stream stream = client.OpenRead(imageUrl))
{
this.FoundBitmap = new Bitmap(stream);
stream.Flush();
}
}
}
and...
public void SaveImage(string filename, ImageFormat format)
{
if (FoundBitmap != null)
{
try
{
FoundBitmap.Save(filename, format);
}
catch (Exception)
{
throw;
}
}
}
When I use the SaveImage method for the second time I get the exception "a
generic error occurred in GDI+"
I don't understand why this happens. Can someone please help me to solve
this problem.
Thanks a lot in advance,
Bart