Embed your images into a .DAT file with this builder

Discussion in 'Share Your Creations' started by Oran, Feb 8, 2008.

  1. Oran

    Oran Member Licensed User

    This application allows you to build a simple .DAT file to contain your embedded images. It will allow you to distribute only one .DAT file instead of all your .BMP images. Makes it nice to keep your distribution with as little files as possible.

    Basic knowledge information -- Images added to the .DAT file are indexed starting with zero up to the amount of images that you have. For example if your application uses 10 images (example below) then your .DAT index will be 0-9

    1.] Count how many images you will want to have in your application and the order you want to add them (not that that matters)

    2.] Decide on a file name, this example uses Images.Dat

    3.] Use the syntax: alFiles.Add("imagename.jpg") <--- this can be .JPG or .BMP -- does not matter

    4.] Either add more alFiles lines or delete depending on the count of images you came up with in step 1.

    5.] From your desktop, simply just --> RUN <-- the application, DO NOT COMPILE IT..

    6.] The ImageBuilder will then search for and delete any prior versions of your Image.dat and then rebuild it for you.

    7.] TIP! All the image files you are adding should be in the same folder as this .SBP folder

    8.] When done, you will have a single .DAT file to put in your application folder


    1.] From your main form, add an ArrayList component and name it IL1 (for Image List 1) and position it out of the way of any of your other controls.

    2.] Create the following SUB anywheres in your applications .SBP code:

    Sub RetrieveImages (file)
    num = bin.ReadInt32 'read the number of images.
    For i = 1 To num
    End Sub

    3.] Next, on the App_Start event, add the following line: RetrieveImages("Images.Dat")

    4.] On each form where you wish to display an Image control, use the following code: ImageControlName.Image = IL1.Item(5)

    5.] Example: imgAbout.Image = IL1.Item(5)

    Where in the above example, I have an image control called imgAbout and the photo for that is in the .DAT file in Index position 5

    That's it....

    Happy Programming!

    Attached Files:

    Last edited: Feb 8, 2008
  2. Smurfy2000

    Smurfy2000 Member

    Very Nice,

    THANK YOU:sign0060:

  3. klaus

    klaus Expert Licensed User

    Hello Oran
    I intend to use your idea for the images of the IconEditor.
    But I have more than 50 images, and found it boring to enter all the names into the code.
    So I took the liberty to add some functionalities to your code:
    - load the filenames from a directory
    - handle the files in a listbox remove, up, down
    - make the DAT file
    - read a DAT file and view the different images

    I have added the new version with
    - source code
    - desktop exe file

    Hope this complement will also help others.


    Update 2008. 02. 11 V1.2
    Added a configuration for the file extension.

    Update 2008. 02. 13 V1.3
    Added Save list function, saves the last used list and loads it at the next start of the program.
    Added insert (<) function, inserts a single file before the selected item in the list.

    Update 2008 02. 13 V1.4
    Added Add (+) function
    Added compiled version for device

    Update 2008 02 18 V1.5
    Added a save function allowing to save images back into files

    Update 2008 03 04 V1.6
    Corrected an error in the Insert function

    Update 2008 03 05 V1.7
    Changed program name to 'ImEmB' , name too long on the device.
    Added *.gif and *.png file types for embedding
    Replaced some Buttons by ImageButtons with the images embedded in a file.
    The look has changed a bit.

    Update 2008 04 11 V1.8
    In the Viewer the proram allows now to display 1, 4 or 9 images

    Attached Files:

    Last edited: Apr 11, 2008
  4. Oran

    Oran Member Licensed User


    That's awesome! Good work. That's what this community is all about.... Actually I can't really take all the credit. I found some scraps of code around the forum and put that little tutorial together but you took it to the next level. Awesome! I will use this to make the files for my apps....

    Oran ///
  5. klaus

    klaus Expert Licensed User

    Hello Oran
    I am glad that you agree with the evolution of the ImageEmbedBuilder.
    Have you made some tests about the program loading speed on the device when you have a certain number of images.
    What do you think about changing the file extension from DAT to IMG decause the SetupBuilder generates also DAT files and this could be confusing.

  6. Cableguy

    Cableguy Expert Licensed User

    the File extension will be of no importance as long as t is known by the program...
    I have a trend to create my own extension for some of my programs, so that I know wich files to look for..
    you could take the multi thread Path and load the images, in whatever file extension you wish, along side with a small splash screen...
  7. klaus

    klaus Expert Licensed User

    I added a configuration for the file extension, so the user can choose what he wants.
    The program is updated in my previous post.

  8. Oran

    Oran Member Licensed User


    I find the speed to be good. The addition of extension ability is good and I agree with Cableguy that it does not matter so long as your program knows it. I also use an extension that will save me lots of time in updating or the such.
  9. klaus

    klaus Expert Licensed User

    Hello both,
    I agree with you that the extension doesn't matter, but in the first version the extension was DAT and if you read a wrong DAT file which was not an ImegeEmbedBitmap file there was an error. But anyway with the extension configuration it is more flexible.
    I have not yet tested the speed.

    Last edited: Feb 19, 2008
  10. klaus

    klaus Expert Licensed User

    There is a new update to version V1.3
    After using the program I found that the following functions were missing.
    - Added a Save list function, saves the last used list and loads it at the next start of the program.
    - Added an Insert function, inserts a single image before the selected item in the list.

    Update in my first post or this thread

    Best regards
    Last edited: Apr 8, 2008
  11. Cableguy

    Cableguy Expert Licensed User

    The evolution is awsome...
    btw when will we have the new version of iconedit with the image.dat files?

    Can you please add an optimized compiled exe for the device, I'm having troubles compiling it...
  12. klaus

    klaus Expert Licensed User

    Hello cablaguy
    The compiled version for the device is now included in the last update.

    I have created in EmbeddedImagefile with all the images of the IconEditor, but for the moment I have a problem when I assign images to ImageButtons in the IconEditor, I get an out of memory message. I have not yet found what happens.

    Will keep you informed.

    Best regards
  13. Cableguy

    Cableguy Expert Licensed User

    Hi Klaus...Glad to ear from you...I didnt expect the image embeding would be such a pain...:sign0161::sign0013:
    If you'd like, I can also have a Go at it....and see what cames up of it....
    Here in Portugal we have a saying that reads "Two heads think better than One"....:sign0188:
  14. klaus

    klaus Expert Licensed User

    Hi Paulo,
    The problem of the ImageButtons is solved, yesterday I was looking closer to what happens, before sending you the code, and found a problem with ImageButtons. You will find the details in:

    I did it late in the evening, during the day I was hiking in the mountains. I have joinded a picture from yesterday, just to allow some dreaming.

    Best regards
    Last edited: Feb 15, 2008
  15. Cableguy

    Cableguy Expert Licensed User

    Were do i sign in for a job there?!?!?!?:sign0188::sign0188:
  16. dzt

    dzt Active Member Licensed User

    Hi Klaus,

    Seeing this makes it more difficult for me to concentrate on my work. I can't wait for tomorrow to go for skiing.
    Of course nothing like the Alps:)
  17. Oran

    Oran Member Licensed User


    I like it! Keep it coming!!! :) I like spreading an "Idea Virus"...

    For those that are not aware of this book... I HIGHLY recommend it, it's a good read..

    By Seth Gordon... "Unleashing the Idea Virus" http://www.sethgodin.com/ideavirus/ this book shows you how to think "outside" of the box...

    Anyways... just my .02 worth.. :)

    Dave ///
  18. klaus

    klaus Expert Licensed User

    There is an update to version V1.5 available in the original post.

    Best regards
  19. alfcen

    alfcen Well-Known Member Licensed User

    Hi Folks
    Here is another splash screen image to 'embed' in your dreams :)
    Haisai from the Ryukyus where snow is being imported for the kids.

    Attached Files:

  20. klaus

    klaus Expert Licensed User

    Hallo Robert
    The colors of the scenery in your picture are amazing, the graduations of the blue of the sky into the turquoise of the water is wonderful.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice