A more handy Warhol

After posting my Warhol shortcut, I got a couple of good suggestions for improvements. They overlapped to some extent, so I put them together into a new Warhol.

First, David Sparks pointed out that it would be helpful to end the shortcut by opening Photos so you can both see the new image and do something with it. And Leddy, in the Automators discussion forum, had a suggestion for running it both the Share Sheet and directly from Shortcuts without running into memory constraints. As I was trying out Leddy’s suggestion, I learned that Warhol wasn’t constrained by memory when run from the Share Sheet. (Apparently I’d run into that problem during one of the the early iterations of Warhol and never went back to check if the later improvements made it efficient enough to avoid the memory constraint.)

So now Warhol can be run from both Shortcuts and the Share Sheet in Photos. If it’s run from Shortcuts, it finishes by opening Photos. If it’s run from the Share Sheet, Photos is already open.

Here are the steps in the improved Warhol:

StepActionComment
0 Warhol Step 00 This would generally be run from the Share Sheet in Photos.
1 Warhol Step 01 This only works with one image, so if more than that selected, take just the first one.
2 Warhol Step 02 If this was really run from the Share Sheet, there will be something from the Step 1.
3 Warhol Step 03 So store that something in thePhoto for later use.
4 Warhol Step 04 If Warhol was run directly from Shortcuts, there’s no photo passed to it, and the output Step 1 is empty.
5 Warhol Step 05 So ask the user to select an image…
6 Warhol Step 06 And store that image in thePhoto.
7 Warhol Step 07
8 Warhol Step 08 This is a dictionary of dictionaries, which we’ll use to resize the images and assemble the grid. The keys of the “outer” dictionary are the grid sizes you see in the left column. The keys of the “inner” dictionaries are count and width.
9 Warhol Step 09 Put up a menu for choosing the grid size from the dictionary in Step 8.
10 Warhol Step 10 Resize thePhoto to the width value from the dictionary item chosen in Step 9.
11 Warhol Step 11 Ask if the photos in the grid should be tinted.
12 Warhol Step 12 If yes…
13 Warhol Step 13 For the number of photos in the grid, which is the count value from the dictionary chosen in Step 9…
14 Warhol Step 14 Select an image at random from the Tints album.
15 Warhol Step 15 Resize the tint image and overlay it onto the resized version of thePhoto. Width and Height are the width and height of the resized photo. For the opacity of the overlay, I tried several values and landed on 40%. You may prefer something else.
16 Warhol Step 16 Add the tinted image to the photos list.
17 Warhol Step 17 We’re done assembling the tinted photos.
18 Warhol Step 18 If no tinting…
19 Warhol Step 19 For the number of photos in the grid, which is the count value from the dictionary chosen in Step 9…
20 Warhol Step 20 Add the resized version of thePhoto to the photos list.
21 Warhol Step 21 We’re done assembling the untinted photos.
22 Warhol Step 22 We’re done handling the tinted/untinted option.
23 Warhol Step 23 Arrange the images collected in photos into a grid with a 1-pixel white line between them.
24 Warhol Step 24 Save the grid image to Photos.
25 Warhol Step 25 If nothing was passed in, Warhol was run from Shortcuts…
26 Warhol Step 26 So open the Recents album in photos to see the newly made image.
27 Warhol Step 27