Embed and retrieve images in a data file

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.
 

Attachments

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
 

Erel

Administrator
Staff member
Licensed User
You should use BinaryFile.RetrieveFile instead of BinaryFile.RetrieveImage.
 

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:

Erel

Administrator
Staff member
Licensed User
This should do it:
B4X:
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, ...
 
Top