Bitmap Dispose() Problem

M

Manuel Adam

Hello!

I am using an web application to resize some JPG files.
First I use WebClient to download the Image from the Web.
Then I use the Bitmap Class to Save it as a different file.
Later I delete the bigger picture.

I had some trouble to resize Gif files with my function. So I used to
convert Gif to Jpg first.
Then I used the same as rescribed before.

The problem is that when I try to delete the converted Gif->JPG file,
I always get the error: File In use.

I used:
Bitmap myBitmap = Bitmap(gif_file);
myBitmap.Save("new.jpg",ImageFormat.Jpeg);
myBitmap.Dispose();
// myBitmap != null

Dispose() works so far,
I can delete gif_file using File.Delete(gif_file);

BUT I cannot delete new.jpg ?
Only later in Explorer.

What could be wrong?

Manuel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top