Fave photos to desktop wallpaper (with widget, etc)

Recently I’ve been discussing formatting address data then from Apple Photos. This was for use in my ongoing Wallpaper shortcut. I described it as…
… It does need PixelMator Pro to run…

The aim of it is to select a random ‘favourite’ photo from my Apple Photos, adjust the size and crop where needed to fit the desktop, tint the picture by a defined amount (30% currently), overlay a ‘widget’ at the screen bottom, which shows; Address, ‘camera’ used, and the datestamp of when it was taken, finally a bit of debug data saying when it was set.

I know I’ve got a lot of variable cleaning up to do, there are probably better ways of doing some of things I’ve done. Planned:

  • Settings moved into a dictionary
  • Work around to get rid of duplicate Postcode data
  • Work around to get rid of duplicate Street data
  • Save out various 'debug data - ful address, Map URL, ’ etc into a defined Apple Note
  • Look to see if the overlays can be done without using Pixelmator
  • Option to add a ‘mini’ Map overlay image bottom right (may be too small to be useful)

Any suggestions / tips etc would be appreciated…

Wall 07 - 29.shortcut (30.2 KB)
.

@peavine I’ve now updated the shortcut (not re-uploaded as still testing) to parse the split lines to handle situations where the post code is in the street (still testing) and line one is the post code (that works).

dbrewood. I tested your new shortcut and encountered one issue (which you may be aware of). If the photo has no location data, the If Street has any value action and the If Latitude has any value action are both found to be true, which results in the final wallpaper as shown below. I don’t know of a fix, but I’ll spend some additional time on this later today.

More as a matter of personal preference, the code that resizes a portrait image appears to work as expected, but it often returns a result that might not be desired. A temporary workaround that avoided this with my test photos was to add a condition to the Find Photos action requiring that the width of any found photo be greater than 3500 pixels. Anyways, I thought a user option to skip portrait photos might be a nice enhancement.

These are, of course, minor issues and the shortcut continues to work great.

dbrewood. I found a possible solution for the location issue. The Get Location action returns a location object. and with my test photo the location is the Atlantic Ocean. Nothing can be done with this. However, if the location data is missing, the Street property returns an empty string. So, testing the length of the street property can be done as shown below. With this change, the shortcut correctly showed No Location on the wallpaper.

Okay here we go…

  • In the new version I’ve re-looked at the locational data (needs rewriting as soon as I can) as what it really needs to check whether the full address we use for the split is null or not. At the moment though isolating the best source for that data is proving to be an issue (not got tome to check - family issues). Once identified then the investigation ‘loops’ used can be simplified and reworked
  • The split code has been adjusted and now uses [PC] & [Str in TC] indicators after the ‘street portion’ of the widget text - these indicate if - line 4 contains line 1 omit line 1 (postcode in line 1), and line 2 contains line 1 - omit line 1 (Town/city includes street). Easier to see when in operation.
  • [PC] code reworked and moved into the ‘otherwise’ portion of the loop.
  • A LOT of address tweaks made as I found some of the address changes you mentioned caused issues with addresses not showing at all on a number of my photos where addresses are present.
  • Added the width limit you suggested when selecting an image.

Once the ‘location loop’ situations are resolved I now need to work on speeding things up, initial selection of the image is way too slow!

Latest incarnation of the shortcut attached.

Wall 07 - 39.shortcut (31.4 KB)

1 Like

dbrewood. You had earlier mentioned the possibility of using a dictionary for some of the shortcut settings, and I was interested in how this might be implemented. Just as an interesting project for me to work on, and possibly for your use when the location/address issues are resolved, I tested the following, which seemed to work OK. Getting the tests in the if statements to work correctly was a bit of a chore, though.

Dictionary Test.shortcut (22.8 KB)

Thanks! That may well be very useful shortly.

The latest (test) version is attached. Changes are:

  • Location code simplified and reformatted, it now works using the ‘Full Address’ which is the data used on the split lines. I’ve been testing all my scenarios here and it looks good (so far)
  • Multi-location code removed
  • Debug code removed as no longer really needed
  • Removed Pixelmator Pro overlay code and replaced with Apple Shortcut function

Hopefully it should work better and faster for you.

Wall 07 - 43.shortcut (30.7 KB)

dbrewood. I tested your new shortcut, and it reported the following error. This is because addresses in the US only have three lines.

I did some testing and if a US address is a street address, the lines are in the format of:

3800 Main St
Prescott AZ 86305
United States

If the address is not a street address, the lines are in the format of:

Ridge Top Trail
Prescott AZ 86305
United States

If the photo has no location information, the shortcut returns 0 lines for address.

Given the simplicity of US addresses, I rewrote your shortcut on a proof-of-concept basis for US addresses. This is of no help to you, but I mention this only because the use of line count to test for location/no-location seems to work well. The only other change I made was to eliminate Favorites as a filter, and I did that to facilitate testing.

The following screenshot shows the section of the shortcut that I edited.

Wall 07 - US - 5.shortcut (29.6 KB)

BTW, in limited testing, I’ve been impressed with the ability of the shortcut to determine my location when in the forests near my house. I may repurpose your shortcut for my own use to work on a single file selected in a Finder window.

Hmm the US of A only using 3 address lines is not something I was aware of. In the version I’m working on so far I’ve:

  • Added ‘padded’ lines to the address to get around the 3 line problem and creating my own variable to hold the address data
  • Moved the address creation routines to the top of the shortcut
  • Changed the split logic to work using the new variables for validation and data itself
  • Created new variables for the split data (will start using them soon)
  • Moved the ‘flags’ to the end of the widget.

All under testing now…

P.S. The shortcut will eventually be able to work on a file selected in Finder as I do want it to have that functionality.

1 Like

In addition to what I listed above the latest version changes are:

  • The split lines now use the FullAddressText & CharCount variables
  • Split line text variables created
  • Widget magnification re-investigated and updated (x9.5)
  • Split lines text changed to use the split line variables.

All looks to be working well apart from a very rare condition (I think) where missing data causes ‘,’ & ‘Address padding 1’ display issues in the widget. This is going to take a bit of working out logic wise as to what causes it.

Anyway here is the latest version…

Wall 07 - 51.shortcut (31.4 KB)

1 Like

dbrewood. I tested the latest version of your shortcut, and it worked great.

Very good news indeed!

New version. Changelog:

  • It now uses a ‘SourceFile’ variable
  • Input to the shortcut can either via running it as usual, or Quick Action. This allows you to select any photograph in Finder and use that as input.

The ‘,’ errors reported above I think are fixed as testing with the photo which caused the problem now shows the widget as:

So here you go… I must stress though this is NOT FULLY TESTED but as we’ve a very busy few days ahead I’ll not have much free time to work on it…
Pius this did give me a chance to add in one of the requested features :slight_smile: As always any feedback is appreciated.

If anyone would care to post (or PM me) any non-UK photographs (with geo-data) I’d love to be able to use them as test input for the shortcut :slight_smile:

[UPDATE] - I missed changing a ‘Photos’ variable which resulted in blank wallpapers. Fixed in this version.

Wall 07 - 53.shortcut (31.7 KB)

The blank wallpaper issue is still there, working on it…

dbrewood. I tested version 53, and it showed no location with one of my photos that had a location. This only happens when the shortcut is run as a Quick Action. Running version 53 regularly correctly sets the location. Also, running version 53 as a Quick Action creates a blank text file in the folder that contains the photo.

Yep I saw the same issue here in Quick Action mode. I run it automatically via Shortery and that sometimes is interpreted as a Quick Action and had the same problem that is of blank wallpapers (and no location data) and the text file being saved.

This new version has additional checks run on the source images and if invalid images are detected it re-runs the shortcut.
I’ve aslo turned off the ‘output’ option at the end of the shortcut, when run manually this didn’t do anything, but when run as a Quick Action is generated the spurious blank text file.

Hopefully this version fixes all issues for you, it does here for me :slight_smile:

Fingers crossed!

Wall 07 - 55.shortcut (32.0 KB)

The shortcut no longer creates a text file, but the location is still missing when run as a Quick Action. I emailed you my test photo, which should show a location of “Firewater Trail, Prescott AZ 86305, United States”. I get the same result when the location is a physical address.

dbrewood. The following is from your shortcut:

In preliminary testing, changing the file property to location fixed the issue. I’ll look at this as bit more later today.

Thanks. Noted for further investigation [Update - I’ve made the change here] :slight_smile:

I’m having to revert the shortcut to remove the Quick Action functionality as it stops Shortery from running it.

When I’ve got a few more things off my to-do list incorporated into it. I’ll revist it to see if I can get the Quick Actions working without issue as that would be a cool thing to get fully working.

This is the latest reverted shortcut (no Quick actions) but it’s working fine for me with Shortery for changing my wallpaper.

Wall 08 - 2.shortcut (31.5 KB)