Start New Discussion within our Software Development Community


I have an old legacy application developed by someone else many years ago that we use day to day in our business. My boss would like to update the logos and images used within the application to give it a re-vamp. I do not know what the program was written in, but I have been able to open the application in a resource viewer (Resource Hacker) and update strings and some bitmaps.

My problem however, is that the main logos are not kept with the other bitmaps. They are under the heading of RCDATA in the resource editor (example code below). Is there any way that I can update this image to our new logo? ie. what encoding does the use so that I can save our new image with that encoding and update the executable.

object Image1: TImage
Left = 0
Top = 0
Width = 417
Height = 257
Picture.Data = {



You are looking at the form resource data. Essentially, when the original program was written (in Delphi), the programmer used a TImage component in the forms designer, double clicked the Picture property in the Object Inspector, and Loaded a bitmap file (or anything else his Delphi was able to load) and stored it in the DFM file.

You can replace the image easily by starting a New Application (Win32 -- not console or anything weird), dropping a TImage component on the form, then populate the image from file. By default Delphi takes Microsoft BMP images (so your replacement image should be saved as a 24-bit BMP file). Load it so that it is displaying in the IDE on the form. Save all.

Now, go find your form's DFM file. Find the image object. It starts with the word 'object' and ends with the word 'end'. If you left all names at the default, it will look something like this:

object Image1: TImage
    Left = 136
    Top = 234
    Width = 18
    Height = 18
    Anchors = [akLeft, akBottom]
    Picture.Data = {
    Visible = False
    ExplicitTop = 230

Copy the stuff for the Picture.Data (lines 7 through 25 in my example image above). Depending on the size of the image you added, it could be a pretty long listing. Make sure you get it all.

As you've already noticed, the resource you want to modify has its image object listed the same way. Paste your new image object data in place of the old data.
Be careful that your new image has the same dimensions as the resource you are replacing -- and that you don't modify other parameters either -- unless you know exactly what you are doing. (The length of the 'object''s Picture.Data in the DFM file may vary depending on the image data.)

Now, when the modified application creates the form from the modified DFM resource data, it will use your image instead.

Hope this helps.

This article has been dead for over six months. Start a new discussion instead.