473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Load Image Without Locking File

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
Nov 21 '05 #1
4 8351
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

------------------------------
"Scott Meddows" <sc******************@tsged-removeme.com> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #2
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

------------------------------
"Scott Meddows" <sc******************@tsged-removeme.com> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #3
But this is in the MSDN documentation.

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
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

------------------------------
"Scott Meddows" <sc******************@tsged-removeme.com> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #4
But this is in the MSDN documentation.

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

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
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

------------------------------
"Scott Meddows" <sc******************@tsged-removeme.com> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Eric.Jones | last post by:
I've encountered a strange error with loading delimited files from a Samba (SMB) network drive, has anyone else seen this before? (Platform: WinXP Pro, UDB PE 8015, level 02060106, SAMPLE db) ...
3
by: user | last post by:
Hello I finally managed to save Bitmap that reprezented my pictureBox to jpg file, but now how can i load from that file to Bitmap again ? Bitmap does not have any Load or Open method (like...
0
by: Scott Meddows | last post by:
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...
1
by: jz | last post by:
Hi All, I have an ActiveX control project, in the main form, I have an image control and load a JPG image from by setting Picture property of Image; I build it and everything is good, I...
4
by: John please don't spam me! | last post by:
VB.Net 2003 Hi, 2 questions: 1. I want to read a file in without locking it, as it is Log file. 2. I want to be able to read from the last point it wa read upto. The project is: Search...
6
by: nuhura01 | last post by:
Hi all... My system contains an image which I have saved it at client side. Unfortunately, when users want to view the image, the image doesn't loaded. If i'm not mistaken, it is set at the HTML...
2
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map, ..well now I want to load in...
2
by: Marcolino | last post by:
Hy Guys, I have a problem loading JPG in a Picture Box. I need to load a jpg files into a PB and then unlock the original JPG. I'm using following code: Dim picture1 As PictureBox Dim...
14
by: Steve K. | last post by:
I have a method that I use to get a System.Drawing.Image from a file without keeping a handle on the file open (so I can delete the file). Here is the code: <code> public static Image...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.