Photoshop Actions Mini Course - Creating Puzzle Effect

Photoshop Actions Mini Course - Creating Puzzle Effect

We will continue our journey with Photoshop actions. In this post we will record an action to automate creation of Puzzle effect with each puzzle piece on its own layer. I will explain you entire process from start to end with all necessary information, step by step tutorial and guidelines how to record actions with more any number of puzzle pieces or some similar effect. We will use Insert Path command which is one of the most useful commands available from the Actions panel menu. Let's get started.

Planning and preparation

This section is optional and not necessary required to record puzzle action. You can skip this section and follow only step by step instructions or to download action recorded during this tutorial and you are done. Basically, I will explain you my personal approach when recording actions.

In this case we want to create a very popular puzzle effect. It is not that difficult as you may think, in fact this should be an easy task with a lot of fun. I have started a series of post with the tag: How things work and it is recommended to read every post from that series because knowledge about digital images in general and how things work will greatly help you when working in Photoshop including and when recording actions.

Planning an action

The very first task is to define what we want. Our goal is to automate creation of the puzzle effect. Each of the pieces should have a same source image, right? We need to cut out pieces, place them on separate layers for flexibility and to to stylize them. It is certainly possible to automate this task since all we need is an image, selection and Layer via Copy command. The effect can be created using Layer Style dialog and distributed to other pieces using Copy/Paste what you have probably done many times so far and it is possible to record these commands.

Another thing to take into account is that we have images with different dimensions, orientation and aspect ratio. So we need to record, if possible, an action which will work with images which does not have the exact same dimensions, orientation and aspect ratio. Puzzle pieces should be square or nearly square. It is obvious that we must take a different approach to divide into 6, almost square pieces, image with horizontal 3x2 aspect ratio and image with vertical 5x7 aspect ratio. To divide an image with horizontal 3x2 aspect ratio into 6 equal pieces we should have 2 rows and 3 columns while for 5x7 ratio we must use 2 columns and 3 rows. That' different approach that I am referring. It is not even possible to divide a square image into 6, square or nearly square pieces so for effect with 6 pieces we can discard square images. Puzzle effect is not locked to 6 pieces, it can have 9, 12, 24 and so on pieces. It is up to you to do some math and observation before even start recording actions what will make your life much easier and process faster.

As we proceed with action you will see that we are going to record only a couple of steps which we are going to duplicate and with small change we can create as many actions as we want in a relatively short time to successfully divide our image into 100 or more puzzle pieces. This is possible and can be done successfully only if you spend some time defining you action and thinking about the problem you want to solve. Otherwise, you will end up with a bunch of actions which does not deliver expected, good final result and you will start scrubbing your head. Finally, you will be prompted to come to this section and spend some time to plan your action.

Insert Path command

This is one of the most useful commands available from the Actions panel menu. This command can be used to draw the path during action so it is not necessary to have that path in the document or custom shape saved on your system and loaded. The path can be used to create shape, selection, and so on. In essence path is a description of the shape and good news is that description can be percentage based. Percentage based means relative to the document bounds, so shape will automatically adopt relative to document what gives us a lot of flexibility. A path which occupies left half of the document when recording action will always do that regardless of document dimensions, resolution and aspect ratio.

Let's say you want to use path to select the left half of the document. You need to create document with any dimensions and orientation in the first place.

Next is to draw path which will have following bounds or description:  top side of the path starts at the top of the document, right side of the path is exactly at the 50% of the document, bottom side of the path is at the bottom of the document and left side of the path starts at the left side of the document. That will be recorded in the action and path with the same description will be drawn regardless of the document dimensions, resolution and orientation.
Percentage based path recorded in the action

Although the percentage based description is flexible it does have dependency. A shape which occupies left half of the square document does not look exactly the same as shape which occupies the left side of the document with 3x2 aspect ratio.

Here is a sample of creating a selection from a percentage based path which is recorded in the action (screenshot above). Regardless of document size and orientation, result will be always the same: left side of the document will be selected.
Selection from percentage based path

On the other hand, if you are using the pixel based description of the path, then the exact same path will be drawn regardless of document dimensions and orientation. In case when using the pixel based description of the path, then the position of the path plays a role. If you record command to draw path at the top left corner with dimensions: 300px Width and 200px Height, action will always draw that, 300x200px rectangle in the top left corner regardless of the document dimensions and orientation.
Pixel based description of the path

After converting path to selection, that may select left side of the document or may select one small, top left part of it, what depends on document dimensions, orientation and aspect ratio.
Selection created from pixel based desription of the path

To select the left side of the document as described above (pixel based record of the path), you must use a 300x200px path in the document which is 600x200px, horizontal orientation and 3x1 aspect ratio. Too many dependencies without much flexibility.

Anyway, this can be also useful because you do not have to use path as it is drawn, path can be used as a starting point to allow users to transform path and ensure that document have expected or required aspect ratio. Path with dimensions 300x200px actually has 3x2 aspect ratio, right? If you record step to insert the path and record the next step to enter free transform mode, then you can allow user to transform or scale path with constrained proportions. Once the user confirms scaling that will overwrite recorded description of the path and new one, created by the user will be valid for the next step in the action.

Preparing to record puzzle action

For the preparation you can create puzzle effect to see the final effect before recording the action. What can help you is to capture puzzles in the real World using your camera and to evaluate effect or you can simply go online and to play puzzle game. Once you are done with the game create a snapshot and take a closer look. You will get some conclusions and idea how to create a style for the pieces which should be easy to achieve using Bevel and Emboss effect.

There are many different approaches you can take to create paths that you need for the action. One way is to trace the contour from the captured image or screenshot using Pen Tool in Photoshop. Another even easier approach is to create a path in Illustrator and to import it in Photoshop simply by copying and pasting path. The third, easiest way is to obtain vectors online. One of the resources where you can find tons of vectors is depositphotos.

Here is a link to download my Illustrator source file. I have traced several contours which are in the top left corner. The next step was to create rectangle in 3by2 proportions and to use: Object > Path > Split Into Grid command to divide a rectangle into equal pieces. The rest of work is to move traced contour over the grid. After positioning pieces I managed end anchor points to overlap, then I used: Window > Pathfinder > Divide. Lastly, I used Shape Builder Tool to create the final shape which you can see on the screenshot below.
puzzle shape with path in illustrator

I must skip entire process because the scope of this tutorial is to explain you how to record actions. Everything is done pretty well but I must admit that I took a lazy or easy path to create the shapes of the final effect because there are many other things to cover in this tutorial. You can do a better job by observing pieces on real World example. In case you want a tutorial for Illustrator with precise step by step instructions, then please leave a comment below this tutorial.

Create 3x2 document in Photoshop and paste path from Illustrator: Edit > Paste > Path. After pasting path use white arrow tool (Direct Selection Tool) in Photoshop to select each individual piece: Alt/Opt + click the path.
Alt + click with the Direct Selection Tool to select the path in photoshop

Delete path using Ctrl/Cmd + X shortcut, create new path in the Paths panel using the page icon at the bottom and paste copied path from the clipboard (Ctrl/Cmd + V). You should have 6 paths in the Paths panel, which must cover the entire image or document. It's up to you to work with continuous tone image or with a blank new document while recording action. Save PSD file with paths and we will use it later to record some steps. Here is a link to download PSD file with paths which I will use for this tutorial.
Path panel in photoshop with prepared paths

Step 1 Record steps to ensure requirements are met
We are going to divide the process in several smaller actions what will make testing easier. A couple of steps at the beginning, we can use to ensure that everything will work as we expect. Go and create an action set (Puzzle Pieces, for example) then click on the page icon to create action which you can name with any name you want. It is easy to change the action name later, give it a name: Preparation, for example.

Click on the Actions panel menu and select Insert Menu Item. When Insert Menu Item dialog appears, select File > Open command, then click on OK to record the first step. That step will prompt user to navigate to the image on the hard drive.
Record step: Open

Stop recording and test action. Run action and navigate to the image on your drive. After opening the image, add one additional layer or do something with the image just to prompt Photoshop to ask you if you want to save changes while we are recording few next step.

Click on Begin recording button. We are going to record step which will duplicate open image and close original. Those steps are required to prevent user to overwrite original file. It is easy for anyone to open PSD file and after playing action to use the Save command which will overwrite original.

Go to Image > Duplicate and just click OK without changing anything in the document.

Select previous document using mouse button and go to File > Close. When Photoshop asks you whether you want to save changes just click No. Now you should have 4 steps in your action.
After recording Close step

Lets take care in case user have layered file open. Record step Flatten Image using Insert Menu Item and mentioned command from the Layer menu. We will skip step to convert color mode, which you may find useful to add to your action. Optionally, repeat process using the Insert Menu Item and this time go to Image > Mode > RGB. Click on Stop playing/recording button to stop recording and close currently open image. If you have recorded Convert Mode step, then drag it above step: Flatten Image.

Step 2 Record steps to create Puzzle pieces
In this step we will record steps for which we need our PSd template with paths. Go and create a new action in Puzzle Pieces set, give it a name: Piece 1. Click on Stop playing/recording button.

Ensure that you have open PSD template with paths in Photoshop.

Another thing to ensure is that you have Ruler displayed (Ctrl/Cmd + R) and that measurement unit is set to Percent. Right click on the ruler and choose: Percent.
Right click on ruler and choose: Percent

Click on the Paths panel to see its content and select Path 1 (top left piece).

Click on Begin recording button so you are in recording mode. Go to Actions panel menu and choose: Insert Path command. In the Actions panel you will see Set Work Path command recorded.
Insert path command for the first piece

Select white arrow tool from the Toolbox (Direct Selection Tool) then right click and choose: Make Selection. When Make Selection dialog appears on your screen just confirm on OK button. Feather Radius should be set to 0, Anti-aliased turned on and New Selection radio button checked. This will add another step to your action: Set Selection.
Make selection from path - first piece

With the selection active go to Layer > New > Layer Via Copy. Now you have one more step in your action: Layer Via Copy and new layer in your Layers panel: Layer 1 with the first piece. We will skip renaming this layer, that is homework for you.

The next step is to select the bottom most layer because we want this layer selected after creating each piece but before creating selection from the path. Press Alt/Opt + [,] to record another step: Select back layer.

Click on Stop playing/recording button to stop recording action.

Delete Layer 1 and test action. It should create Layer 1 with the first piece and to select the Background layer which is bottom most layer. We have ensured that we have a background layer in our document in Preparation action (Flatten Image Step). It is wise to use keyboard shortcut to select Background layer and ensure that action will work on localized versions of Photoshop.

Optionally, you can create a Work Path using any of vector based tools like Rectangle Tool (Path drawing option set from Options Bar) and to record step to Delete Current Path.
record delete work path step first piece

Now we are somewhere. Let's record additional steps to create Puzzle Pieces. It is much easier of what you think, We have set almost everything in advance.

Step 3 Record additional steps to create the puzzle pieces
In this step go and duplicate action: Piece 1. Rename duplicated action to Piece 2.

Select Path 2 in the Paths panel.

Click on Set Work Path step in your Piece 2 action.

Go to Actions panel menu and choose: Insert Path.
Record insert path command for the second piece

You will see another Set Work Path step recorded just below selected step with the same name.

Stop recording the action and delete topmost step: Set Work Path by simply dragging it to the trash can in the Actions panel.
Drag top most set work path to trash can

You can test the second action (Piece 2) just ensure that Background or bottom most layer is selected before running the action. Action should create Layer 2 in your Layers panel with the second piece and select bottom most: background layer.

Should I tell you this? Duplicate action Piece 2 and rename it to Piece 3 then repeat step with Insert Path command, but this time ensure that Path 3 is selected in Paths panel.

Repeat process until you have actions for all 6 pieces.
all six actions with pieces recorded

Test your actions
It is time to test our actions and to see what we have done so far. Go and test all your actions starting with action: Preparation. After running action: Preparation, grab your Crop tool and crop the image to 3by2 aspect ration then run actions: Piece 1,2,3,4,5 and 6. Here is a link to download actions that I have recorded while writing this tutorial. Action that we are going for is here and I will explain you additional steps in the very next tutorial.

To be continued

It is already long tutorial and we will continue in the very next post. If you have any doubts or some questions, please do not hesitate to leave the comments or to contact me for help.

Related tutorials in Photoshop Actions - Mini Course
Photoshop Actions Mini Course Part 1
Photoshop Actions Mini Course Part 2
Photoshop Actions Mini Course Part 3
Photoshop Actions Mini Course Part 4
Photoshop Actions Mini Course Part 5
Photoshop Actions Mini Course Part 6 - Creating Puzzle Effect (Part 2)

Product used in this tutorial:
Adobe Photoshop CC 2014

Photoshop Help / About actions and the Actions panel
Photoshop Help / Playing and managing actions
Photoshop Help / Creating actions


Popular posts from this blog

How to Change Artboard Size in Adobe Photoshop

Free Puzzle Pieces Actions For Photoshop and Elements

Old Weathered Vertical Wooden Planks Free Image