BASICS: Photoshop Batch for Pix2Pix - jamahun/fakelab.studio GitHub Wiki
These instructions outline how to go from a single image, to a side by side [A][B] 2048x1024 image through photoshop batch processing.
NB: Ensure you make a copy of your dataset as we will overwrite the original.
Action 1
Create a new file named photoshop_fill_square.js and paste the contents:
#target photoshop
app.preferences.rulerUnits = Units.PIXELS;
var docRef = activeDocument;
var size = 1024;
docRef.width>docRef.height ? docRef.resizeImage(undefined, size, undefined) : docRef.resizeImage(size, undefined, undefined);
app.activeDocument.resizeCanvas(UnitValue(size,"px"),UnitValue(size,"px"));
Create an action called 'Resize_Fill' referencing this script by going to Actions > Record and then File > Scripts > Browse. Stop recording after execution and undo changes.
Action 2
After running action 1, create another action called 'ProcessImage' which transforms your image, resulting in the eventual layer structure:
Layer 1 (processed image) - SELECTED
Layer 0 (original image) - UNLOCKED
Action 3
Make a new action called 'SideBySide' which will put the images side by side.
The original image should be on the right, with the 'new' image on the left.
The action should consist of:
- Image > Canvas Size > Width to 2048
- Move the processed image to the left
- Move the original image to the right
- Flatten the entire document with Layer > Flatten Image
Action 4
Make a new action called 'Combine_A_and_B', begin recording, and execute the previous three actions sequentially.
Whilst still recording, save the file (JPG, quality 8-10), and close the document.
(Note: the action may still be recording, so open a new document, stop the action, and then delete the 'Open' action.
Batch process
Batch the collection by going to File > Automate > Batch, choosing your Combine_A_And_B action.
Note: You can still edit your "ProcessImage" action and the rest will update.