How to quickly merge many png images into one jpg file?

There are 2 folders with pictures. Folder " Right "and folder" Left".

In these folders there are 100 pieces of png images with a transparent background. In total, there are 200 png images in 2 folders.

In the folder " Right " - there are pictures that should stand on the right

In the folder " Left " - there are pictures that should stand on the left

You need to combine all these images so that each image from the folder "Right" used 1 time all images from the folder "Left" and then, so that each image from the folder "Left" used 1 time all images from the folder "Right"

Each folder contains the images that should appear in the final (glued) image from a certain side - on the left and on the right.

The total should be 100x100=10000 images.

How to do this automatically, for example, with what scripts (javascript/php), or does Photoshop have built-in tools? Batch processing does not seem to be suitable for this.

Author: Михаил, 2020-06-21