Hidden Photoshop Script EASILY Generates Random Fills!
Sometimes Photoshop’s pattern presets do not fit your photo composite, but we have a solution for you!
In this tutorial, you will discover this hidden Photoshop script that will allow you to generate a random fill from a pattern and create your own.
Table of contents
Tutorial Image
To follow along the tutorial, download the image here.
Remove Background Using Adobe Sensei
Start by extracting the Dollar bill from its background using Adobe Sensei, an Artificial Intelligence (AI), makes creating a selection more straightforward.
To do that, choose Select > Subject.
If the AI misses out a part of the object that you want to select, you may use either the Quick Selection tool to add or even subtract from the selection.

With the selection active, click on the layer mask icon to create a layer mask based on the selection.
If need be, you can use the Brush Tool and paint on the mask with black (#000000) to hide pixels or paint with white (#ffffff) to reveal. You may also use the Select and Mask Workspace to refine the mask edges.
Convert the Dollar Bill Into a Pattern
Select the Rectangular Marquee tool from the Toolbar.
Then, make a selection a little larger than the dollar bill.

Select the Layer thumbnail, not the Layer Mask thumbnail.

Choose Edit > Define Pattern. Name for your new pattern preset.

Create a New Layer and disable the original layer.

Generate the Fill with the Random Pattern Fill Script
Bring up the Fill dialog box by pressing Shift Backspace (Windows) or Shift Delete (macOS).
On the Fill dialog box, set the Contents to Pattern.

As the Options appear, set the Custom Pattern to the Dollar Bill pattern preset you just created, which you may also find at the very bottom of the list.
Check the box for Script and on the drop-down menu beside it, select Random Fill.

Then, press OK.
The previous step brings out the Random Fill dialog box with several options available.
Start with Color randomness and Brightness randomness.

The Color randomness determines the variety of colors that will apply in the pattern. Meanwhile, the Brightness randomness applies a different range of brightness among the patterns.
If you want to set the pattern with the same color, then adjust the Color randomness to 0.

You can also set the Brightness randomness to 0.2 for a slight difference in brightness.

Then, check the box for Rotate pattern, so the pattern rotates randomly.

Increase the Density to its maximum at 10 pixels.

By setting the Minimum scale factor and the Maximum scale factor to 1 the resulting generated dollar bills will be the same size as the original.

Then, press OK.
Upon exiting, you’ll see how your working document is now filled with the Dollar bill pattern!
Power Tip for More Realistic Results!
Start by creating a New Layer.
Once again, bring out the Fill dialog box by pressing Shift Backspace (Windows) or Shift Delete (macOS).

Then, press OK.
The Random Fill window will remember the previous settings.
Start by setting the Minimum scale factor and the Maximum scale factor to .25 as this sets the Dollar bill to 25% of the original size.

Also, set the Density to 9 pixels, to leave gaps in the fill.

Then, press OK.
NOTE: If you can’t see the transparency checkerboard, you might need to disable the previous layers to see its full effect.
Double-click on the New Layer’s side to bring out the Layer Style window and click on the Drop Shadow style.

You can edit the Structure and the Quality of the Drop Shadow style to achieve realism according to your preference. But it’s also good enough to use the default settings. Then, press OK to see it in effect.
Create another New Layer and repeat the process of bringing up the Fill window by pressing Shift Backspace (Windows) or Shift Delete (macOS), and press OK.
When the Random Fill window pops up, it will remember the previous settings you applied and press OK. This will apply a new random fill layer of the dollar bill pattern, which helps create depth.

To apply the same Layer Style with the Drop Shadow in the previous layer, click-and-drag the fx icon over to the New Layer and drop it there.

And here’s the final result when you keep on repeating the process until you achieve a realistic bed of Dollar bills that you can use for a photo composite or a poster project!
Be sure to test it out with some of your favorite objects and tag us #PTCvids when you upload it on your social media!
Final Image
Drag The Slider To See Before & After