Set a background image into a dmg file

On OS X, distributing our software using a dmg is pretty easy and welcomed (mst of the time).

Take a look at Xojo.

You want to do the same, but you do not know how to place a background image there ?

  1. Run Disk Utilities (whatever your own name is),
  2. Create a dmg image at your application need size,
  3. Quit Disk Utilities.

Now, the hard part: define (draw) your image background and save it using "background.png” as its name.

In the dmg, create a folder and name it “background”.
Copy your “background.png” image into that “background” folder.

To make it invisible, you have to add a leading dot (.) to its name, but Yosemite does not allows you to do that (what a strange idea).
So to do that, we do need an AppleScript.

Run the AppleScript Editor (whatever its name is) and copy / paste the code below:

tell application "Finder" #Add a dot in front of the "background" folder set name of item "background" of front window to ".background" end tell

Be sure that you have your dmg folder open as the front window / you do not have a windoid open (this can be checked for you, but if you read this, you are capable of doing that),
Save the script (for the next time) using, for example, this name: “Set background folder to invisible.scpt”.
Run the script.

Now, close the dmg window (yes, the folder disappears, but no background image) and re)open it to see the nice image you now have in the dmg folder background.

This was my last trick of the year.

Have a Happy New Year,


I found an occurence where the image file name is… “backgroundimage.tiff”.

So, maybe the name and the file type is meaningless ?

I will stick with “background.png” (easier to remember and png is good).

You can only make retina + non-retina images with tiff and not png. I forgot how this was called “multi page tiff” or something like that.

Tools like DMG Canvas will help a lot. After you design your disk image you just have to launch and build the new one when you make an update. Super easy super fast :slight_smile:

Emile, I wish things like this were that easy, but for simple things it might.

I’ll just add two factoids: what is in the .DS_Store is the most critical thing, because that is what truly stores the image (or at least it’s reference/alias) for the CD. Since it is invisible (due to the dot) it’s difficult to maintain. There are a lot of instances where what you see may not be what you’ll eventually get when you burn to disk. I’ve had my share of “platters”.

I use a custom REAL app to “lock” and “unlock” a disk image; that is, I make two folders invisible (one is for copy-protection, the other contains the background image) but I don’t use the dot method, I set the FolderItem’s Visible property. When I “unlock” I also delete the .DS_Store file so the Finder can generate it itself when I assign the image.

The other factoid is: make sure you use 72dpi images for the background! I accidentally used 300dpi ones and when Lion came out, the images look pretty small unnaturally.

72 dpi images are different than 144 (or higher) images ! (unlike some says in this forum sometimes ago).

72 dpi images: you are correct too for the standard Finder folder background images too.

In mi step by step, I set the leading dot (to make the folder invisible) at the end of the process for that reason: the process is done. Eventually, if this does not works at once, we can clear that dmg file and restart 'til we really got it right.

.DS_Store: this file is meant to set the folder location and size (and other stuff ?). Not mandatory, since the folder will open in the main screen (the one that holds the (Finder) MenuBar.

If you check, say a Memory Stick, you will see a ton of invisible items in the Memory Stick main folder (two plist files, etc.). They can be deleted (I do that from a Windows 8.1 machine) without troubles. BUT DO NOT DO THAT WITH YOUR INTERNAL (or external) HARD DISK.

At last, I cannot anymore talk about CD… Both my MacBook Pro and that Windows 8.1 machines does not have a CD/DVD… burner(s); not Ethernet port !

I use Preview who convert automatically to 72 dpi when you Copy / Paste an image. But, once you face that issue, you will remember it !!!

.DS_Store tells Finder what it’s parent window should look like. If you want a window to be styled (say a background image on your disk image) the .DS_Store file is required.

This is far away from dmg stuff (If I am not wrong).

Also, you are right if the window display is by Icons (vs by List). ;-:slight_smile:

Last time (some years ago) I checked, I do not find documentation for .DS_Store format in the Apple (or elsewhere) web sites.