Customizing Lion login window background image

Cem
Valued Contributor

I need to find a way to change the login window background image resolution to fit for every screen size, or different monitor that might be connected. So far I am either getting tiles or oversize or fits (if I match the computers screen rez). I have tried 256 x 256 pixels as in original but getting tiles.

png file path is in here:
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSTexturedFullScreenBackgroundColor.png

I wish Casper Configuration Profiles could have handled this too... just looking at it, but can't see anything related.

Anyone has achieved this?

Cheers

Cem

1 ACCEPTED SOLUTION

Cem
Valued Contributor

I've decided to use PolicyBanner option... I don't fancy fiddling with this every time Apple OS update comes up!
http://support.apple.com/kb/HT4788

I just created a nice jpeg and it looks good. Also users have to click Accept to the policy. So they can't say they didn't see it :)

View solution in original post

30 REPLIES 30

Matt
Valued Contributor

I think thats the same background used by Mission Control FYI.

beneb
New Contributor III

I created a custom 50 x 50 px tile and it works for each instance it was tested on (I couldn't say for sure that it works on every resolution). However, it was quite painstaking to make it look right and I wouldn't say it's perfect.

nessts
Valued Contributor II

i have taken to making my image fit as if its anchored in the bottom left corner, make the image to fit the biggest screen 2560x1440, but make the graphics work so that its usable on the smallest as well. Seems to work for me.

sean
Valued Contributor

Apple have chosen to do a tile as oppose to a picture. If you wish to do this, then you will have to match the picture size to that of the resolution of the monitor connected. You can automate this using 'sips', but if you have monitors of different resolutions connected to the same machine, then it may only look correct on the monitor that you match; you wont be able to set a different resolution per monitor. I can't recall the actual look.

At best, you could use system_profiler to pull the monitor that is the 'main' monitor, get the resolution and then adjust the image to match this monitor. This will include padding, centre crop, etc as a monitor may be widescreen or not and what aspect ratio is the original picture?

All of this is on the assumption that the original image, that is being used for the tiling on the login window, isn't used anywhere else that would also look incorrect. I've never seen changing this as having an affect on anything else, Mission Control included.

This was something I looked at, but as we are still desperately avoiding Lion due to the amount of bugs it has, I never really implemented it. I believe this worked, but was put on a back burner, so worth checking it first. There are some specific set paths for our environment and it also chooses a random picture from a specified directory each time the script is run. Pictures supplied were always 1600X1200, not sure that mattered though! As say, never truly finished.

#!/bin/bash

###########################################################################################################
#######################   F R A M E S T O R E   [loginwindow]    S C R I P T   ############################
###########################################################################################################

## Script for changing the login background picture.  For Lion, this will only look correct on the 
## main monitor

###########################################################################################################
#####################         V E R S I O N    C O N T R O L             ##################################
###########################################################################################################

## Sean Holden  - originating author , [V1.0], [06-09-2011]

## V [2.0] - [redesigned because of Lion.  Lion tiles and doesn't use pictures.  Picture needs to match 
## monitor display ratio] - [sholden] - [17-02-2012]


###########################################################################################################
#####################             S C R I P T   S T A R T                ##################################
###########################################################################################################

desktopPicture="/opt/fc/media/login/login.jpg"
lionPath="/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSTexturedFullScreenBackgroundColor.png"
swVers=`sw_vers -productVersion | cut -d "." -f 1,2`

## Randomly select one of the files in /opt/fc/media/pictures.  This is the location that all new pictures
## should be placed for the background picture at login.
files=(/opt/fc/media/pictures/*)
myPicture=`printf "%s
" "${files[RANDOM % ${#files[@]}]}"`

case $swVers in

    10.7)
        ## Lion requires a conversion of the picture to match screen size.
        mainResX=`system_profiler SPDisplaysDataType | egrep "Resolution|Main Display" | grep -B 1 "Main Display" | head -1 | awk '{print $2}'`
        mainResY=`system_profiler SPDisplaysDataType | egrep "Resolution|Main Display" | grep -B 1 "Main Display" | head -1 | awk '{print $4}'`
        mainRatio=`echo "scale=2;${mainResX}/${mainResY}" | bc`

        if [ ! -f $lionPath.old ]
        then
            mv $lionPath $lionPath.old
        fi

        ## Get selected picture aspect ratio
        picY=`sips --getProperty pixelHeight "$myPicture" | grep ":" | cut -d " " -f 4`
        picX=`sips --getProperty pixelWidth "$myPicture" | grep ":" | cut -d " " -f 4`

        picRatio=`echo "scale=2;${picX}/${picY}" | bc`

        pathToCopyTo=$lionPath
        ;;
    *)
        ## Check the plist file to determine the location of the file is set
        myPath=`defaults read /Library/Preferences/com.apple.loginwindow DesktopPicture`

        if [[ "$myPath" != "$desktopPicture" ]]
        then
            defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture $desktopPicture
            logger message "/Library/Preferences/com.apple.loginwindow DesktopPicture has been set"
        fi

        pathToCopyTo=$desktopPicture
        ;;
esac

function editPicture {
        newY=`echo "${picX}/${mainRatio}" | bc`
        sips -c  $newY $picX $myPicture -o /tmp/login.jpg
        sips -z $mainResY $mainResX /tmp/login.jpg -o $pathToCopyTo
}

function copyPicture {
    ## Copy the result to the path determined by /Library/Preferences/com.apple.loginwindow.plist.  If this is
    ## not set, then we will see the default picture instead.
    cp $myPicture $pathToCopyTo
}


## If picture ratio doesn't match screen ratio, then convert and copy final result otherwise copy.
if [[ $mainRatio != $picRatio ]]
then
    editPicture
else
    copyPicture
fi

Cem
Valued Contributor

@Matt; Mission Control background file located here:
/System/Library/CoreServices/Dock.app/Contents/Resources/defaultdesktop.png

@bbyleen; 50 x 50 created me mosaics :) are you sure its 50 not 500?

@nessts; I think I need to test this more. So far this is the closest one that what I am trying to achieve...

thanks for the replies guys!

Cem
Valued Contributor

Hi Sean, that looks good... I will test this and let you know the result/s. It will be tomorrow though, as its almost 6:30pm in London now.

Cheers

Cem

chris_kemp
Contributor III

Another way I found: Titanium Software's Deeper has a setting that changes the default Login screen background to an image file.

http://www.titanium.free.fr/download.php?sid=20170573a0d274300a87beb5fe338686

beneb
New Contributor III

Sorry, I thought you wanted a seamless tiled background based on your post that you were using 256 x 256 image. My 50 x 50 is a repeating tiled pattern (seamless) similar to apple's default linen.

Not applicable

As always, don't forget to drop a note to http://www.apple.com/feedback/macosx.html asking for a restoration of this functionality. I want this to not be as big a pet peeve for me as it is, but there you have it.

nessts
Valued Contributor II

and remember that some OSX update in the future could reset your login screen back to that really nice grey piece of fabric looking background.

stevewood
Honored Contributor II
Honored Contributor II

I was able to use a 256x256 image file, which is nothing more than a solid color and it worked fine. In fact I was able to change the Apple logo as well to be a white version of our company logo.

I took all of this, packaged it up and use a postinstall script to move it all into place, making backup copies of the original files. The result looks like this:

http://cl.ly/1T1e1p3o1i1l3u1E0j1O

The script I use is here:

http://goo.gl/qEokK

And here it is too:

#!/bin/sh

# Name: moveloginbackground.sh
# Date: 2012-02-22
# Author: Steve Wood (swood@integer.com)
# Purpose: script moves new background file and logo files for Lion 10.7 login window

# setup some variables

newBackgrnd='/Library/IntegerIT/loginbackground/NSTexturedFullScreenBackgroundColor.png'
newAppleLogo='/Library/IntegerIT/loginbackground/apple.png'
newAppleLinenLogo='/Library/IntegerIT/loginbackground/appleLinen.png'
backupDir='/Library/IntegerIT/loginbackground/origFiles'
logoDir='/System/Library/PrivateFrameworks/LoginUIKit.framework/Versions/A/Frameworks/LoginUICore.framework/Versions/A/Resources/'
backgndDir='/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/'

# backup the existing files

if [ -d $backupDir ]; then
    mv $logoDir"apple.png" $backupDir
    mv $logoDir"appleLinen.png" $backupDir
    mv $backgndDir"NSTexturedFullScreenBackgroundColor.png" $backupDir
else
    mkdir $backupDir
    mv $logoDir"apple.png" $backupDir
    mv $logoDir"appleLinen.png" $backupDir
    mv $backgndDir"NSTexturedFullScreenBackgroundColor.png" $backupDir
fi

# now move the new files in

mv $newBackgrnd $backgndDir
mv $newAppleLogo $logoDir
mv $newAppleLinenLogo $logoDir

# now change owner and permissions

chown root:wheel $logoDir"apple.png"
chown root:wheel $logoDir"appleLinen.png"
chown root:wheel $backgndDir"NSTexturedFullScreenBackgroundColor.png"

chmod 644 $logoDir"apple.png"
chmod 644 $logoDir"appleLinen.png"
chmod 644 $backgndDir"NSTexturedFullScreenBackgroundColor.png"

# we are all done here.  Leave backups in place
exit 0

McAdams
New Contributor III

Argh. Broken in 10.7.4?

The "NSTexturedFullScreenBackgroundColor.png" is not getting used anymore. Back to the default. Not sure why.

nessts
Valued Contributor II

correct, i have been trying for weeks and have not found the right thing, although changing the apple.png and appleLinen.png does work and i think works better, since it always gets centered and sizes appropriately for all computers.

FastGM3
Contributor

I just upgraded to 10.7.4 yesterday and noticed my custom image has been zapped. Which means now I have hundreds of users who are also going to lose their background. I'm glad to see this discussion getting addressed, here.

So now can I use my old "NSTexturedFullScreenBackgroundColor.png" file and change the name to apple.png and appleLinen.png then push it out in a policy to all my 10.7.4 computers?

Or do I have to resize my old "NSTexturedFullScreenBackgroundColor.png" file first then rename it and push it?

TIA,
Chuck

nessts
Valued Contributor II

i went for a smaller png with a transparent background, but i suppose if you make the image big enough it will hide all of the lame linen

taugust04
Valued Contributor

Has anyone figured out where the "new" background image is located? I worked on this for a few hours so far and I can't figure out what file it is, and where its located.

~Ted

tkimpton
Valued Contributor II

MCX?

Cem
Valued Contributor

I've decided to use PolicyBanner option... I don't fancy fiddling with this every time Apple OS update comes up!
http://support.apple.com/kb/HT4788

I just created a nice jpeg and it looks good. Also users have to click Accept to the policy. So they can't say they didn't see it :)

Kev
New Contributor III

The "solution" appears to be posted here...

https://discussions.apple.com/thread/3939907?start=15&tstart=0

I have been looking into this as well, ever since I upgraded a test machine to 10.7.4. As far as I can tell, the new image has to be tiled, unlike previously when we could use large full screen images.

Lucky for me, I replace the Apple logo with my text in a .png so the only thing I will be losing is the background that I had utilized behind it. They have not changed the file that is referenced for the Apple logo.

taugust04
Valued Contributor

@Kev - thanks for the link. Patrick Fergus also posted a similar solution over at the MacEnterprise mailing list, which is a little more straightforward than browsing the Apple Discussion thread:

I didn't write it, but here's a tutorial for changing the login window background in 10.7.4: http://www.mactasia.co.uk/change-the-login-background-in-os-x-lion-10-7-4 The basic idea is: - Decode SArtFile.bin with SArtFileTool - Replace the assets, 267.png and 267@2x.png - Encode SArtFile.bin with SArtFileTool - Replace SArtFile.bin I'd think 72 dpi images that are 256x256 (for 267.png) and 512x512 (for 267@2x.png) would probably be correct. I also had issues until I ensured the png files had alpha channels, but that may not have been related.

Kev
New Contributor III

@taugust04 - Thanks!

Following that link landed me at http://www.loginox.branox.com/ and their app works in 10.7.4.

BaddMann
Contributor

I really need a command line method of taking a source image and adjust the resolution of the image according to the resolution of the login back ground. I found this:
https://github.com/Tonyliu2ca/LoginBackground

but I've been able to make it work.
Has anyone else found another way of doing this?

tkimpton
Valued Contributor II

Im having to do this now. I was going to leave the 10.8 computers and just do the 10.6 login picture but that will look strange to the end users and makes it look like i couldnt be bothered.

Think i will try the suggestion of titanium deeper as suggested and snapshot with composer and see what happens.

chris_kemp
Contributor III

WOW. Just tested Loginox on my workstation...that was SO easy to do! That's definitely going in the toolkit!

tkimpton
Valued Contributor II

Thanks Chris I will try that. Need to snapshot with Composer and try and package up the thing. Dont want to be going round manually setting it!

tkimpton
Valued Contributor II

Currently testing on 10.8

Deeper is using SArtFile

tkimpton
Valued Contributor II

Loginox doesnt let me revert on 10.8 but Deeper does. Also with deeper snapshotting with Composer works well :)

only problem now is to sort the tiling and a logo

chris_kemp
Contributor III

Forgot about Deeper...had to get the 10.8 version, but that looks quite good too. :-)

tkimpton
Valued Contributor II

ive been messing about with Deeper and i think the best way is using Steves method. thanks Steve ;)

Unfortunately for me the designers have given me horrible files for Desktop Wallpaper pictures.

For my test box I set a solid colour instead of grey the tile like Steve did and a coloured company logo and they just dont look right on a 10.8 login.

Instead im opting for keeping the boring Apple grey tile and just choosing a grey company logo to replace the Apple one. If Apple decide to change things (like they always do) then the Login picture wont get screwed (or at least it wont be noticable so much!)

For the remaining 10.6 machines out there im going to blast out just a solid grey DefaultDesktop.jpg

If i do decide to do more on it then i would definately recommend using Deeper to just see what looks ok, but then to actually use Steves method.

FastGM3
Contributor

Has anyone experienced the custom login window getting trashed once FileVault get's enabled? Our custom logo above the login fields gets cut off, once FileVault get's turned on. It drives me NUTS!