Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sill

macrumors 6502a
Original poster
Nov 14, 2014
880
563
What happens when you right-click on a random pic on the internet and select "Set as Desktop Background"? That picture becomes the new desktop, but where is it stored?

For a couple of years my desktop was an insanely great Calving & Hobbes pic, one of those brilliant ones where the duo was inserted into a real photo. This one has the two in the lower left of a picture of woods on the edge of winter. Perfect.
I wanted to temporarily change to a new pic to celebrate an accomplishment, and planned on changing back to the Calvin pic after a couple of days. I searched for it but it didn't show up in any of my background picture folders. I would think that it had to be stored somewhere in order to show up every time the computer was restarted, but where?
 

Sill

macrumors 6502a
Original poster
Nov 14, 2014
880
563
That was a great resource, thanks. However, it didn't show me where my pic was at. It has to be cached somewhere, its just not in that directory or any subs.
 

Fishrrman

macrumors Penryn
Feb 20, 2009
29,175
13,225
1. click on the desktop
2. In the "go" menu, choose "go to folder"
3. Enter this in the box: "/Library/Desktop Pictures"

Does that help?
 

Gregg2

macrumors 604
May 22, 2008
7,266
1,237
Milwaukee, WI
Shoot! I could tell you where the proper Pictures (that's its name) folder is if I was at my Mac.
That's the default anyway. I believe you can choose any folder from System Preferences.
 

DeltaMac

macrumors G5
Jul 30, 2003
13,749
4,572
Delaware
Hmm...
Good ideas here --- but, I think the OP has (sometime in the past) right-clicked on some random image that he liked, and chose to "Set Desktop Picture".
The desktop picture is set to that image.
Where is THAT image found, if you need it after changing to another background temporarily?
Note: Your desktop background will stay as you set it, even if you delete the original image file that you used to set the desktop, and that original image is gone from your system. The "Set Desktop Picture" process must save the image somewhere. Where is that? There's no image copy saved to the Desktop Pictures folder, for example.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,990
8,874
A sea of green
Hmm...
Good ideas here --- but, I think the OP has (sometime in the past) right-clicked on some random image that he liked, and chose to "Set Desktop Picture".
The desktop picture is set to that image.
Where is THAT image found, if you need it after changing to another background temporarily?
Note: Your desktop background will stay as you set it, even if you delete the original image file that you used to set the desktop, and that original image is gone from your system. The "Set Desktop Picture" process must save the image somewhere. Where is that? There's no image copy saved to the Desktop Pictures folder, for example.
As stated in the article link I posted, Safari stores the image at:
~/Library/Safari/Safari Desktop Picture.WHATEVER​

where WHATEVER is the suffix appropriate for the image type, such as jpg, png, etc.

At least that's what Safari did in 2012, when that article was written.

Someone can confirm this by using Safari to set the Desktop picture, then looking in that folder for the image file. If it's there, and it looks like the desktop picture, then Safari is still doing it that way. If not, then Safari is doing something else.


Another approach to this, that requires setting the desktop picture from Safari, is to look in the 'defaults' state for desktop images for the path of the desktop picture.

The following pasted into a Terminal window should list one or more lines that contain the patter "ImageFilePath". One of those might be the path of interest.
Code:
defaults read com.apple.desktop | grep "ImageFilePath"

I'm not running a recent enough OS version, so I can't confirm what the output will be. If nothing is output, change ImageFilePath to Path and see if any output is produced.

Do this command-line both before and after using Safari to set the desktop picture, and look for the changes.

Note that Safari (at least in older versions) will replace its stored desktop image with another. So if you've set the desktop image twice, or done it again since the awesome image from a long time ago, then the awesome image is almost certainly lost forever, unless you happen to remember where you got it from.
 

DeltaMac

macrumors G5
Jul 30, 2003
13,749
4,572
Delaware
Maybe that will help someone who sets the desktop picture from Safari, but I have never used that feature in Safari.
I simply click on that option by right-clicking the image file, and choosing to set the image from there. Safari is not involved at all.
The Set process does "something", the background image changes to that image.
I just can't discover what file/plist actually changes to register that new image (and where that background image gets stored?
That command takes me to the file that YOU referred to, and ~/Library/Preferences/com.apple.desktop shows some previous desktop picture selections, but that file has not been updated for more than 4 years, and doesn't show ANY images since probably an upgrade to Yosemite, and I choose some other image (sometimes system-provided, sometimes nice images that I like from somewhere else) And, I would see recognizable file names, as some are personal pictures over the last 3 or 4 years. NONE of those show up, and certainly not the recent picture that I just changed to, not more than an hour ago - a picture that I have never used before. I deleted the picture file after changing the desktop, restarted, and the background picture remains as I set it. Just the image itself is nowhere to be found.
Must be in a cache somewhere, but I can't find it - at least not by the filename of the original file.

And, of course, if I change the desktop NOW, and don't still have that picture stored somewhere, there's no way back (other than the usual Time Machine, or other backup process)
 

chown33

Moderator
Staff member
Aug 9, 2009
10,990
8,874
A sea of green
Maybe that will help someone who sets the desktop picture from Safari, but I have never used that feature in Safari.
I simply click on that option by right-clicking the image file, and choosing to set the image from there. Safari is not involved at all.
The Set process does "something", the background image changes to that image.
I just can't discover what file/plist actually changes to register that new image (and where that background image gets stored?
That command takes me to the file that YOU referred to, and ~/Library/Preferences/com.apple.desktop shows some previous desktop picture selections, but that file has not been updated for more than 4 years, and doesn't show ANY images since probably an upgrade to Yosemite, and I choose some other image (sometimes system-provided, sometimes nice images that I like from somewhere else) And, I would see recognizable file names, as some are personal pictures over the last 3 or 4 years. NONE of those show up, and certainly not the recent picture that I just changed to, not more than an hour ago - a picture that I have never used before. I deleted the picture file after changing the desktop, restarted, and the background picture remains as I set it. Just the image itself is nowhere to be found.
Must be in a cache somewhere, but I can't find it - at least not by the filename of the original file.

And, of course, if I change the desktop NOW, and don't still have that picture stored somewhere, there's no way back (other than the usual Time Machine, or other backup process)
Here are some Terminal cmd-lines that may help figure out the pathname of the actual background image.

First, we get a list of every possible 'defaults' setting. This will probably be a file with several thousand lines it. Don't worry, you won't have to open it.
Code:
defaults read >~/before

Next, go change your desktop picture using right-click.

Here, we get the same list of every possible 'defaults' setting, but it's output to a different file.
Code:
defaults read >~/after

Finally, we get a list of only the differences between the 2 files, in "diffs.txt" in your home folder.
Code:
diff ~/before ~/after >~/diffs.txt

At this point, it should be safe to open diffs.txt in a text editor, since it probably won't have 1000's of lines.

If you're unsure what might be in it, paste this into a Terminal window before opening the file.
Code:
wc -l ~diffs.txt
The number is the count of lines in the file.

If it's in the thousands, or even hundreds, then that seems to me to be an unexpectedly large number of differences, and it's likely the whole strategy of "find differences of before and after" is flawed. If it's several dozen lines, or even under a dozen, then it's probably a list that contains the pathname of the desktop picture after using right-click to set it. You can post the output here, or just post what you discover about where the file is located.

If there are 0 lines in diffs.txt, then try regenerating the "after" file after waiting several minutes after setting the desktop picture with right-click. The defaults system might take some time to update. Or it could be that setting the desktop picture with right-click is no longer being stored in the defaults system.

You can delete the "before" and "after" files in your home folder without bothering to open them. If you're curious how long they are:
Code:
wc -l ~/after
The output is the number of lines in "after".
 

DeltaMac

macrumors G5
Jul 30, 2003
13,749
4,572
Delaware
output "before" file, then changed desktop picture, and output "after" file.
The 2 files are identical.
The diff file shows nothing (blank)

Just trying to find the graphics file that is kept by the system when a new desktop background is set.
Apparently, outside of the background actually changing, the file system produces nothing at all (?)
 

Sill

macrumors 6502a
Original poster
Nov 14, 2014
880
563
And, of course, if I change the desktop NOW, and don't still have that picture stored somewhere, there's no way back (other than the usual Time Machine, or other backup process)


I just recently set Time Machine up for the first time, so I'm pretty sure my old desktop picture would be in there. Where do you think I should look? Actually, how should I go about looking? As I've never used Time Machine prior to this, I have no idea how to navigate through it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.