Embed and retrieve images in a data file

Erel

B4X founder
Staff member
Licensed User
Longtime 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

  • ImagesFile.zip
    7.1 KB · Views: 502

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
 

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

B4X founder
Staff member
Licensed User
Longtime 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, ...
 

Georg

Member
Licensed User
Longtime User
Transparency

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