PDA

View Full Version : [vb.net] Save Image from Bitmap?


Templarian
02-26-2007, 05:46 PM
I have found an article describing the problem, but have been unsuccessful in getting it to work. See if an image is opened then saved it seems to think the image is opened (therefore locked), so it can't be resaved to the same location.

http://support.microsoft.com/?id=814675


Open:
Dim dlg As OpenFileDialog = New OpenFileDialog()
dlg.Filter = "Tile files (*.png)|*.png|All files (*.*)|*.*"
Dim res As DialogResult = dlg.ShowDialog()
If res = 1 Then
workingimage = Image.FromFile(dlg.FileName)
workingimagesave = dlg.FileName
End If

Save:
workingimage.save(workingimagesave)

Thanks.

kirupa
02-27-2007, 01:49 PM
Did the Bitmap.Dispose() line not work, or is it not relevant to what you are trying to do? Both of those approaches in your link look messy for something that should be simple.

Templarian
02-28-2007, 12:34 AM
^Nothing I've tried works and I don't understand enough to make their horrid reply for a work around work. One would think they would give a VB.net C# ect... example of some sort.

STATUS
This behavior is by design.Its obvious why its suppose to be there but logically it doesn't make sense why its so hard to get around it.

And no the bitmap dispose seems to do nothing from what I've tested. Thanks anyhow.

http://blog.vishalon.net/Post/70.aspx
http://blog.vishalon.net/Post/70.aspx
http://blog.vishalon.net/Post/70.aspx
http://blog.vishalon.net/Post/70.aspx
http://blog.vishalon.net/Post/70.aspx

^For users that needed to know there is the link to the fix.