J
JezB
I have an Image object (i) which I want to write to a file. This does work
but when I later try to do something with this file I get errors, because I
think the file is still 'locked'. I have to restart the application before
the locks are released. I tried it first as:
Image i = ... ; // correctly instantiated to some image
i.Save("image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
// later errors doing something with image.jpg
Then I tried cloning the image before I write to the file, and disposing of
both images after the file is written:
Image i = ... ; // correctly instantiated to some image
Image ii = (Image)i.Clone();
ii.Save("image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
ii.Dispose();
i.Dispose();
// later errors doing something with image.jpg
but STILL I'm getting the errors. I'm not sure if the lock is on the file or
the image it was based on. Anyone know what the problem can be and how to
get round it ?
but when I later try to do something with this file I get errors, because I
think the file is still 'locked'. I have to restart the application before
the locks are released. I tried it first as:
Image i = ... ; // correctly instantiated to some image
i.Save("image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
// later errors doing something with image.jpg
Then I tried cloning the image before I write to the file, and disposing of
both images after the file is written:
Image i = ... ; // correctly instantiated to some image
Image ii = (Image)i.Clone();
ii.Save("image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
ii.Dispose();
i.Dispose();
// later errors doing something with image.jpg
but STILL I'm getting the errors. I'm not sure if the lock is on the file or
the image it was based on. Anyone know what the problem can be and how to
get round it ?