Mobile app version of vmapp.org
Login or Join
Speyer780

: Automate Paste into Selection Currently, Photoshop allows us to Paste a second image into a previous one and then re-size it manually using Free Transform. I would like to know if there is

@Speyer780

Posted in: #Automation #Images #Resize

Currently, Photoshop allows us to Paste a second image into a previous one and then re-size it manually using Free Transform. I would like to know if there is any method or software that allows us to automate this process.

Just draw a selection area on an image, click on the selected area, select an image file and have it appear already re-sized and set in the selection area.

I restate that this doesn't necessarily have to be done in Photoshop. I just want this functionality for images I am formatting.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Speyer780

1 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie315

Photoshop does have Edit > Paste special > Paste into, but this doesn't resize the image to the selection.

It is possible to do this by creating an Action in the Window > Actions panel.

...or it could be done with a script. Script would give you more freedom to do exactly what you need it to do and more automatically as well.



Before you start reading the rest of the post, here's the action in use:







I highly suggest you create the action yourself, as it can be very educating.

However, since the action is super long, I figured I'd share the action file as well: Paste Into Selection.atn Download at your own risk.

...Instructions for creating the action yourself:


Make your selection. ( It doesn't have to be a rectangular selection. )
Start recording the action...
Make a new layer.


Layer > New > Layer...
Don't name it.

Fill it with black


Edit > Fill...
Contents: Black
Mode: Normal
Opacity: 100%

Make a Layer mask


Layer > Layer mask > Reveal selection

Select RGB channel


Click the layer thumbnail

Select the whole document


Select > All

Copy


Edit > Copy

Delete layer contents


Mac: Backspace Windows: Del

Make a new document


File > New...
Don't change the width and height.

Place the image


Place embedded... In older PS versions this is called Place...
Then just place in any image.

Select the whole document again


Select > All

Copy the image.


Edit > Copy

Close the document.


File > Close

Unlink the layer mask.


Layer > Layer Mask > Unlink

Create selection from the Layer mask.


Right-click the Layer mask thumbnail and select Add mask to selection

Paste in the image


Edit > Paste

Re-link the Layer mask to the layer,


Layer > Layer mask > Link

Stop recording the action.
In the Actions panel, click the empty box on the left side of the place command.


This makes sure that PS stops to wait until you select the image you want to place. Otherwise it'll just place the image you placed during the recording.





The action stops at some point to wait for you to press enter to apply a transformation. What you need to do is upsize the image to fill the whole document (as shown in the .gif), so that the image ends up filling the selection.

If you just want to fit the image to the selection, then you can just press Enter to apply the transformation and the action will continue.





You may want to edit the action to fit your needs more specifically.

For example, after step 10, you might wanna run Image > Canvas size... with the Relative option checked and make the document bigger.

This way the image would end up slightly bigger than the selection, giving you some room to move it inside the Layer mask.





If you are planning to use this often, you can set a hotkey to launch the action. Sadly the hotkey options for Actions are very limited.

You can however get around it by making a script that launches the action. You can give scripts way more versatile hotkeys and you can even override PS hotkeys.

Just make an exmpty file called Paste In Place.jsx and put in this:

doAction ('Paste into selection', 'My Actions');



This code assumes that the action name is Paste into selection and that the action is in a folder called My Actions.


After 'installing' the script to the PS scripts folder and restarting photoshop, you can find it in the: Edit > Keyboard shortcuts.... Just expand "File" and scroll way down to find the script and give it a hotkey. For example, I set mine to: Cmd+Alt+Ctrl+V

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme