Skip to content

Reverse engineering of macOS dynamic wallpapers

Quentin Ligier edited this page Feb 27, 2023 · 9 revisions

Different dynamics

  1. Choosing the wallpaper depending on the light or dark theme that is enabled;
  2. choosing the wallpaper depending on the time of the day;
  3. choosing the wallpaper depending on the sun position.

File format

The file used here for example is the updated Catalina.heic. Passing the file in exiftool (exiftool -k -G Catalina.heic) gives us:

[ExifTool]      ExifTool Version Number         : 12.47
[File]          File Name                       : Catalina.heic
[File]          File Type                       : HEIC
[File]          File Type Extension             : heic
[File]          MIME Type                       : image/heic
[File]          Image Width                     : 6016
[File]          Image Height                    : 6016
[QuickTime]     Major Brand                     : High Efficiency Image Format HEVC still image (.HEIC)
[QuickTime]     Handler Type                    : Picture
[QuickTime]     Image Spatial Extent            : 6016x6016
[QuickTime]     Image Spatial Extent            : 6016x6016
[QuickTime]     Image Spatial Extent            : 6016x6016
[QuickTime]     Image Spatial Extent            : 6016x6016
[QuickTime]     Image Spatial Extent            : 6016x6016
[QuickTime]     Image Spatial Extent            : 6016x6016
[QuickTime]     Image Spatial Extent            : 6016x6016
[QuickTime]     Image Spatial Extent            : 6016x6016
[XMP]           XMP Toolkit                     : XMP Core 5.4.0
[XMP]           Solar                           : YnBsaXN0MDDSAQIDCFJhcFJzadIEBQYHUWxRZBAAEAGqCQ8SFhkdISMmKdMKCwwNDgZRYVF6UWkjAAAAAAAAAAAjQHDgAAAAAADTCgsMEBEHI8A5AAAAAAAAI0BRgAAAAAAA0woLDBMUFSPAIgAAAAAAACNAVAAAAAAAABAC0woLDA0XGCNAVoAAAAAAABAD0woLDBobHCNAJAAAAAAAACNAWQAAAAAAABAE0woLDB4fICNAOQAAAAAAACNAW4AAAAAAABAF0woLDB4iICNAb0AAAAAAANMKCwwaJCUjQHBAAAAAAAAQBtMKCwwTJygjQHGAAAAAAAAQB9MKCwwQKgcjQHIgAAAAAAAACAANABAAEwAYABoAHAAeACAAKwAyADQANgA4AEEASgBRAFoAYwBqAHMAfAB+AIUAjgCQAJcAoACpAKsAsgC7AMQAxgDNANYA3QDmAOgA7wD4APoBAQAAAAAAAAIBAAAAAAAAACsAAAAAAAAAAAAAAAAAAAEK
[Composite]     Image Size                      : 6016x6016
[Composite]     Megapixels                      : 36.2

Dynamic wallpapers are only heif files (with the .heic extension). This one is interestingly a square image (6016x6016). The Image Spatial Extent metadata (and others) indicate there are 8 different images in this single file.

XMP

The Solar metadata is interesting, its value seems encoded in base64. Decoding it gives a string that looks like bplist00, bplist being the magic number of a binary property list.

Converting the binary property list to xml gives the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ap</key>
	<dict>
		<key>l</key>
		<integer>0</integer>
		<key>d</key>
		<integer>1</integer>
	</dict>
	<key>si</key>
	<array>
		<dict>
			<key>a</key>
			<real>0.0</real>
			<key>z</key>
			<real>270.0</real>
			<key>i</key>
			<integer>0</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>-25.0</real>
			<key>z</key>
			<real>70.0</real>
			<key>i</key>
			<integer>1</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>-9.0</real>
			<key>z</key>
			<real>80.0</real>
			<key>i</key>
			<integer>2</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>0.0</real>
			<key>z</key>
			<real>90.0</real>
			<key>i</key>
			<integer>3</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>10.0</real>
			<key>z</key>
			<real>100.0</real>
			<key>i</key>
			<integer>4</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>25.0</real>
			<key>z</key>
			<real>110.0</real>
			<key>i</key>
			<integer>5</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>25.0</real>
			<key>z</key>
			<real>250.0</real>
			<key>i</key>
			<integer>5</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>10.0</real>
			<key>z</key>
			<real>260.0</real>
			<key>i</key>
			<integer>6</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>-9.0</real>
			<key>z</key>
			<real>280.0</real>
			<key>i</key>
			<integer>7</integer>
		</dict>
		<dict>
			<key>a</key>
			<real>-25.0</real>
			<key>z</key>
			<real>290.0</real>
			<key>i</key>
			<integer>1</integer>
		</dict>
	</array>
</dict>
</plist>

The si array contains 10 dictionaries, more than there are images in the file. In those:

  • i is the image index (images 1 and 5 are used twice each);
  • a is the sun elevation;
  • z is the sun azimuth.

Sources

Clone this wiki locally