Load Image Without Locking File

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scott Meddows

    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


  • Ken Tucker [MVP]

    #2
    Re: Load Image Without Locking File

    Hi,

    Open the image with image.fromstrea m.


    Dim fs As New System.IO.FileS tream("C:\camer a.bmp", IO.FileMode.Ope n)

    Dim img As Image = Image.FromStrea m(fs)

    fs.Close()

    PictureBox1.Ima ge = img



    Ken

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


    "Scott Meddows" <scott_meddows_ no_spm@tsged-removeme.com> wrote in message
    news:eREHSY2uEH A.3276@TK2MSFTN GP15.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



    Comment

    • Ken Tucker [MVP]

      #3
      Re: Load Image Without Locking File

      Hi,

      Open the image with image.fromstrea m.


      Dim fs As New System.IO.FileS tream("C:\camer a.bmp", IO.FileMode.Ope n)

      Dim img As Image = Image.FromStrea m(fs)

      fs.Close()

      PictureBox1.Ima ge = img



      Ken

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


      "Scott Meddows" <scott_meddows_ no_spm@tsged-removeme.com> wrote in message
      news:eREHSY2uEH A.3276@TK2MSFTN GP15.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



      Comment

      • Scott Meddows

        #4
        Re: Load Image Without Locking File

        But this is in the MSDN documentation.

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



        "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message news:%23gIi3p3u EHA.2876@TK2MSF TNGP12.phx.gbl. ..[color=blue]
        > Hi,
        >
        > Open the image with image.fromstrea m.
        >
        >
        > Dim fs As New System.IO.FileS tream("C:\camer a.bmp", IO.FileMode.Ope n)
        >
        > Dim img As Image = Image.FromStrea m(fs)
        >
        > fs.Close()
        >
        > PictureBox1.Ima ge = img
        >
        >
        >
        > Ken
        >
        > ------------------------------
        >
        >
        > "Scott Meddows" <scott_meddows_ no_spm@tsged-removeme.com> wrote in message
        > news:eREHSY2uEH A.3276@TK2MSFTN GP15.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
        >
        >
        >[/color]


        Comment

        • Scott Meddows

          #5
          Re: Load Image Without Locking File

          But this is in the MSDN documentation.

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



          "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message news:%23gIi3p3u EHA.2876@TK2MSF TNGP12.phx.gbl. ..[color=blue]
          > Hi,
          >
          > Open the image with image.fromstrea m.
          >
          >
          > Dim fs As New System.IO.FileS tream("C:\camer a.bmp", IO.FileMode.Ope n)
          >
          > Dim img As Image = Image.FromStrea m(fs)
          >
          > fs.Close()
          >
          > PictureBox1.Ima ge = img
          >
          >
          >
          > Ken
          >
          > ------------------------------
          >
          >
          > "Scott Meddows" <scott_meddows_ no_spm@tsged-removeme.com> wrote in message
          > news:eREHSY2uEH A.3276@TK2MSFTN GP15.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
          >
          >
          >[/color]


          Comment

          Working...