I want to make an application using Delphi. The problem is I am going to have a lot of TImage
components in it - which will make the exe size extremely large. So far my exe is 20MB large and I have only completed the home page, by my calculations the exe alone will be more than 10GB in size - which is way too much.
How can I make an app with hundreds/thousands of images and yet let the exe be small in size?
Don't put the images in the executable. Keep them in external files and load them at runtime.
This will require you to stop loading the images into the TImage
controls at design-time and instead use dynamic code to load the image, and transfer to the TImage
control. There are many advantages of doing so:
TImage
will persists to a .dfm file in a very inefficient way. You can choose to use PNG or JPEG compression.