Skip to main content
Participating Frequently
January 6, 2022
Question

Randomly fill a picture with certain items

  • January 6, 2022
  • 5 replies
  • 1174 views

Hi everyone. 

 

I have a picture that I want to make different versions of 25+. 

So it's a person with a ball but but I want to fill it with different items, so one will have a smiley face another with an angry one, different colour jerseys, different colour shorts etc

 

Is there any way of having Photoshop randomly filling the picture from a list of items but only allowing certain colours, items to fill certain areas?

 

Thanks

This topic has been closed for replies.

5 replies

c.pfaffenbichler
Community Expert
Community Expert
February 3, 2022

Creating less than all possible combinations could raise some potential problems. 

Because if one were to combine the elements purely (pseudo-)randomly each turn it might happen that some elements in some of the groups do not get used at all or that the same combination arise more than once. 

 

So an approach with a restricted randomness might be called for. 

Participating Frequently
January 24, 2022

I have but I don't understand French unfortunately.

c.pfaffenbichler
Community Expert
Community Expert
January 24, 2022

The Forum offers auto-translation and the Script I posted in post 6 is not french. 

Chuck Uebele
Community Expert
Community Expert
January 15, 2022

As others mentioned, scripting is the way to go, and it really wouldn't be too hard. You have a list of files to insert. On your main file, you use the eye dropper tool to sample the color of a base layer. By the color you get, you make a switch in the code to select one of your files that best matches the color you sampled. To get the sample point for the eye dropper tool, you use the random feature in javascript to generate the X and y values. The attached is a simplistic example. Only grayscale was used to select one of 4 images. The more gray the base was, the wider the random range.

Participating Frequently
January 21, 2022

Okay. Thank you for your responses. 

Ive got another project now in which the number of pictures needed is 500. I will definitely need Scripting for this one. 

Can someone help me with it?

All the colours are in Layers

 

Many thanks.

c.pfaffenbichler
Community Expert
Community Expert
January 22, 2022

Please provide a meaningful description and maybe even the file/s (in low resolution and minus sensitive data if indicated) themselves. 

c.pfaffenbichler
Community Expert
Community Expert
January 6, 2022

What is this actually about and how frequent is the task? 

Can you provide screenshots (including the pertinent panels) to clarify the procedure? 

Where do the »items« exist? Separate files, Layers in the file, …? 

 

As @Mylenium pointed out Scripting seems like the reasonable approach but the prudence of this depends, amongst others, on the frequency of the task. 

Participating Frequently
January 6, 2022

They would be in seperate files and theyre all on my hard drive.

 

This is only going to be a one off task but I thought if I could basically tell photoshop, here is a list of faces, here is a list of jerseys, here is a list of different coloured balls, etc....Make some random pictures.

 

Kind regards

Hassan

c.pfaffenbichler
Community Expert
Community Expert
January 7, 2022

I thought if I could basically tell photoshop, here is a list of faces, here is a list of jerseys, here is a list of different coloured balls, etc....Make some random pictures.

It is possible in principle, how well versed are you with JavaScript and Photoshop’s DOM and AM code? 

Mylenium
Legend
January 6, 2022

Unless you get into heavy scripting with the conditions defined in the code I can't see a way to pull that off. this is way beyond simple datasets, actions and basic scripts. Unless you literally have to do this hundreds of times, it's not worth spending the time to develop a script and 25 variations realyl sounds liek you could do it fast enough by hand. Trying to automate this would be like calling in a helicopter to lift a chair...

 

Mylenium

Participating Frequently
January 14, 2022

What would I need to do if I was to say have 100 picture to then choose 25?

 

How would I script it?

 

Many thanks

 

c.pfaffenbichler
Community Expert
Community Expert
January 15, 2022

Please provide a clear and meaningful illustration of the files-structure and the Layer-structure pf the montage-image (screenshots including the pertinent Panels/Windows).