Results 1 to 2 of 2

Thread: Camera Picture Update

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philadelphia
    Posts
    47

    Exclamation Camera Picture Update

    I am loading a picture from a logitech camera into a picturebox, however when I try to update the picture, I cannot use the same filename because it is being used by my program. Is there a way to free the picture from my program?

    For instance:
    Code:
            Dim bmp as bitmap
            Dim img as image
    
            AxVideoPortal1.PictureToFile(0, 24, "C:\tmp1.bmp", "Gray Scaled Camera") '  This just traps the image from the camera to a bitmap
            bmp = New Bitmap("c:\documents and settings\mark\desktop\picture 1.bmp")
            PictureBox1.Image = bmp
            img = PictureBox1.Image(bmp)
            grayscale(img) 'routine to get grayscale and change picture box to the grayscaled version
    U S A
    Visual Studio .NET
    Windows XP

  2. #2

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philadelphia
    Posts
    47

    Works

    I got it to work, so if anyone needs to do it, here is the code:
    The problem was img was never being disposed.
    Code:
           
    Dim err As ErrObject
            PictureBox1.Image = Nothing
            Try
                img.Dispose()
            Catch
            End Try
            FileSystem.Kill("c:\tmp.bmp")
            AxVideoPortal1.PictureToFile(0, 24, "C:\tmp.bmp", "Gray Scaled Camera")
            img = img.FromFile("c:\tmp.bmp")
            grayscale(img)
            PictureBox1.Image = img
    U S A
    Visual Studio .NET
    Windows XP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width