Copy link to clipboard
Copied
I need some action/scripting help. For year's, I've wanted to create a way to have a folder of images that Photoshop can randomize on the canvas. Someone wrote an article on a tool they created to do this, but they aren't releasing it. Is this possible to create something like this? It does have a little bit of logic, please take a look at this link please Thanks! http://ths.nu/projects/infinite-everything-generative-art/
Thank you so much in advance.
You can try this script"
...#target photoshop
var doc = activeDocument;
var useFolder = Folder.selectDialog ('Select a folder of images');
var mask = '*.*';
var fileList = useFolder.getFiles (mask)
for(var i=0;i<fileList.length;i++){
placeImage (fileList)
}
function placeImage(file){
try{
var x = Math.random()*parseInt(doc.width) - (parseInt(doc.width)/2);
var y = Math.random()*parseInt(doc.height) - (parseInt(doc.height)/2);
var idPlc = charIDToTypeID( "Plc " );
v
Copy link to clipboard
Copied
If someone stated that they did create such a Photoshop Script it is either possible or they write fiction. I see no reason that make me think they write fiction. It not total random or random images, The Image are specially created for their vision of CONTROLLED KAOS not random random more like a deck of cards a game of chance with a set of rules.
Would be a Script not an Action.
Copy link to clipboard
Copied
Everything is possible if you put your mind to it.
I doubt that someone will share a finished solution here in forum, as this sounds as a custom job with specific needs.
Copy link to clipboard
Copied
Yes Tomas every thing is possible... I have searched but not trace similar solution here may be with some different parameters
Copy link to clipboard
Copied
If you like what they came up with drop them a note see it the will give you a copy and their set of rules for their game.
Copy link to clipboard
Copied
You can try this script"
#target photoshop
var doc = activeDocument;
var useFolder = Folder.selectDialog ('Select a folder of images');
var mask = '*.*';
var fileList = useFolder.getFiles (mask)
for(var i=0;i<fileList.length;i++){
placeImage (fileList)
}
function placeImage(file){
try{
var x = Math.random()*parseInt(doc.width) - (parseInt(doc.width)/2);
var y = Math.random()*parseInt(doc.height) - (parseInt(doc.height)/2);
var idPlc = charIDToTypeID( "Plc " );
var desc9 = new ActionDescriptor();
var idIdnt = charIDToTypeID( "Idnt" );
desc9.putInteger( idIdnt, 2 );
var idnull = charIDToTypeID( "null" );
//desc9.putPath( idnull, new File( file ) );
desc9.putPath( idnull, file );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc9.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc10 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc10.putUnitDouble( idHrzn, idPxl, x );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc10.putUnitDouble( idVrtc, idPxl, y);
var idOfst = charIDToTypeID( "Ofst" );
desc9.putObject( idOfst, idOfst, desc10 );
executeAction( idPlc, desc9, DialogModes.NO );
}
catch(e){$.writeln(e)}
}
Copy link to clipboard
Copied
Chuck Uebele provided an excellent starting point for you to, if you feel so inclined, reduce the (pseudo-)randomness that currently determines the placement or add other randomness (for example size or rotation or multiple placements).
What is your »end-game« here anyway?
For which task would you ultimately want to use it?
Copy link to clipboard
Copied
Yes create your deck of image in the order you want them place in and use Chuck script to place them into the current document in that order at some random location.
Copy link to clipboard
Copied
Something that would be good to do would be to create an array that logs where the images are placed. Then when generating a random location, the array is checked to see if an image is within a rough area of an already placed image. That way you don't get a bunch of images right on top of each other.
Copy link to clipboard
Copied
One option to reduce the randomisation might be splitting the target area into smaller parts and assigning each area a certain number of the images that are to be placed.