Embed and retrieve images in a data file

Discussion in 'Code Samples & Tips' started by Erel, Jan 15, 2008.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Two small programs are included in the attached files.
    CreateImagesFile - Embeds a list of image files in a data file.
    ReadImages - Loads the images from the data file into an ImageList.

    You could use these programs to create a single data file instead of many image files.
    ReadImage code should be added to your program code.
     

    Attached Files:

  2. cosmo15900

    cosmo15900 Member Licensed User

    Extraction

    hey when the pics go into the .dat is there a way or code to extract them??
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Yes. See the ReadImages file.
     
  4. cosmo15900

    cosmo15900 Member Licensed User

    what i mean is when they are in the dat file i dont want to bring em in the program i want to beable to extract back to the desktop
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You should use BinaryFile.RetrieveFile instead of BinaryFile.RetrieveImage.
     
  6. cosmo15900

    cosmo15900 Member Licensed User

    can you make a source code or is there 1 already made
    im mostly new to this and i made a mistake of deleting the photos i put in the dat now i need to bring em out
     
    Last edited: Jan 25, 2008
  7. Erel

    Erel Administrator Staff Member Licensed User

    This should do it:
    Code:
    Sub Globals
        
    'Declare the global variables here.

    End Sub

    Sub App_Start
        RetrieveFiles(
    "Images.Dat")
    End Sub

    Sub RetrieveFiles (file)
        FileOpen(c,
    file,cRandom)
        bin.New1(c,
    false)
        num = bin.ReadInt32 
    'read the number of images.
        For i = 1 To num
            bin.RetrieveFile(
    "file" & num & ".dat")
        
    Next
        FileClose(c)
    End Sub
    Files will be named: file1.dat, file2.dat, ...
     
  8. cosmo15900

    cosmo15900 Member Licensed User

    sweet thanks
     
  9. Georg

    Georg Member Licensed User

    Transparency

    it doesn't work when the Imagebutton is transparency. Is there a way?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

  11. klaus

    klaus Expert Licensed User

Loading...