Load Image Without Locking File

S

Scott Meddows

I want to load a multipage TIFF image into memory as an Image object but I read that the FromFile method locks the file.

Can I load this into a stream, close the physical file then manipulate the image there?
Thanks

Scott
 
K

Ken Tucker [MVP]

Hi,

Open the image with image.fromstream.


Dim fs As New System.IO.FileStream("C:\camera.bmp", IO.FileMode.Open)

Dim img As Image = Image.FromStream(fs)

fs.Close()

PictureBox1.Image = img



Ken

------------------------------


I want to load a multipage TIFF image into memory as an Image object but I
read that the FromFile method locks the file.

Can I load this into a stream, close the physical file then manipulate the
image there?
Thanks

Scott
 
S

Scott Meddows

But this is in the MSDN documentation.

Remarks
You must keep the stream open for the lifetime of the Image object.
 

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

Top