Cem ccaBadge
30

Comments

Customizing Lion login window background image

Posted 4/16/12 at 10:26 AM by Cem

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

30

Comments

Matt cmaBadge ccaBadge
Posted 4/16/12 at 10:48 AM by Matt

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

bbyleen
Posted 4/16/12 at 11:45 AM by bbyleen

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 ccaBadge
Posted 4/16/12 at 11:51 AM by nessts

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
Posted 4/16/12 at 12:03 PM by sean

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\n" "${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 ccaBadge
Posted 4/16/12 at 12:16 PM by Cem

@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 ccaBadge
Posted 4/16/12 at 12:23 PM by Cem

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 ccaBadge
Posted 4/17/12 at 11:38 AM by chris.kemp

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

bbyleen
Posted 4/18/12 at 12:53 PM by bbyleen

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.

pete_c ccaBadge
Posted 4/18/12 at 1:20 PM by pete_c

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 ccaBadge
Posted 4/18/12 at 1:27 PM by nessts

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 ccaBadge cugBadge
Posted 4/18/12 at 1:46 PM by stevewood

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 cmaBadge ccaBadge
Posted 5/11/12 at 10:47 AM by McAdams

Argh. Broken in 10.7.4?

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

nessts ccaBadge
Posted 5/11/12 at 10:50 AM by nessts

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
Posted 5/11/12 at 12:47 PM by FastGM3

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 ccaBadge
Posted 5/11/12 at 1:10 PM by nessts

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
Posted 5/11/12 at 2:24 PM by taugust04

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
Posted 5/13/12 at 12:27 AM by tkimpton

MCX?

Cem ccaBadge
Posted 5/14/12 at 11:37 AM by Cem
Solved Solved

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 cmaBadge ccaBadge
Posted 5/14/12 at 3:15 PM by Kev

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
Posted 5/15/12 at 6:11 PM by taugust04

@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 cmaBadge ccaBadge
Posted 5/16/12 at 3:52 PM by Kev

@taugust04 - Thanks!

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

BaddMann
Posted 4/8/13 at 5:09 PM by BaddMann

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
Posted 4/9/13 at 2:24 AM by tkimpton

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 ccaBadge
Posted 4/9/13 at 2:45 AM by chris.kemp

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

tkimpton
Posted 4/9/13 at 3:04 AM by tkimpton

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
Posted 4/9/13 at 12:36 PM by tkimpton

Currently testing on 10.8

Deeper is using SArtFile

tkimpton
Posted 4/9/13 at 12:47 PM by tkimpton

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 ccaBadge
Posted 4/9/13 at 11:09 PM by chris.kemp

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

tkimpton
Posted 4/10/13 at 2:53 AM by tkimpton

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
Posted 4/10/13 at 10:35 AM by FastGM3

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!