I am developing an Outlook 2010 add-in and loading an image from a serialized XML file. The image loads fine, and I can assign it to the pictureBox object in Winform without any problems. The object is stored in
[XmlIgnore]
public Bitmap Image
{
get { return this.templateImage; }
set { this.templateImage = value; }
}
When I try to save a physical file to my hard drive, I do this:
string filePath = Path.Combine(dirPath, item.Id + ".jpg");
try
{
item.Image.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch (Exception e)
{
Debug.WriteLine("DEBUG::LoadImages()::Error attempting to create image::" + e.Message);
}
and I get a general error that occurred in GDI +. I checked the write permissions in the folder and it has write permissions. I'm not sure what is wrong here. I also changed ImageFormat to bmp and png, etc., to make sure it was a conversion problem ... but it is not. Anyone suggest trying something?
source
share