Results 1 to 3 of 3

Thread: Help! Writin an image file from memory to hard drive

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    4
    I am trying to create a function that will save an image to a file. I am
    getting the image from a third party device. The ActiveX control that
    communicates with the device has a couple of properties that I should be
    able to use to write the image file: ImageData which is a pointer to where
    the image is stored in ram; and ImageSize. But, I do not know how to use
    these to save the image to a file. It seems like there should be some kind
    of a function to do this, but I have not been able to find it. Any help?
    Thanks,
    Blake




  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    You need more info from the vendor

    You need to ask them what the imageData points to. Is it a bitmap or a a DIB or is it a jpeg or something else?

    Once you know this, you will still have to research how to access it, but at least someone can help you with that. Whithout the extra info, it's impossible to know what imagedata represents I think.

    Also, what is imagesize? The number of bytes used to render the image? It is meaningless unless they provide you with the data structures as well...

    Cheers
    Paul Lewis

  3. #3
    Lively Member
    Join Date
    Jul 2000
    Posts
    82
    you can try this, i am not sure that it will work though...

    Code:
    'in a module
    Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
    'and then...
    Function SaveFile()
    Dim Target As Byte
    CopyMemory Target,Control.ImageData,hereiamnotsurewhattoputtrysomethingwithLencausehereneedstobethelengthoftheimageintheram
    
    Open "C:\Image.BMP" For Output As #1
    Print #1,Target
    End if
    
    End Function
    or u could forget about the CopyMemory.... part and just put this:


    Code:
    Open "C:\Image.BMP" For Output As #1
    Print #1,Contorl.Imagedata
    End if

    [Edited by ysa1441 on 07-26-2000 at 05:40 PM]

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