DavidHoffman
New Member
- Joined
- Sep 12, 2018
- Messages
- 13
- Lightroom Experience
- Beginner
- Lightroom Version
- Lightroom Version Number
- Adobe Lightroom Classic version: 8.4.1
- Operating System
Can anyone help me with a bit of Javascript? I'm trimming big batches of 16 bpc layered tiff files in Photoshop. I've found a useful script by Jeffrey Tranberry <An photoshop batch script for crop & straighten photo from Jeffrey Tranberry> to batch Photoshop's ‘crop and straighten’ command but it only works on flat files or where the background layer is already selected and I know next to nothing of Javascript.
The background layer of my layered, 16 bit/channel tiff files is not selected when the file is opened so the ‘crop and straighten’ command fails. I could run a separate action on the batch to leave the background selected before I run the script but I'd rather add a step in the script to select the background layer before the script calls the crop and straighten command.
I can make the script work with this ‘flatten’ step:
app.activeDocument.flatten();
but I want to retain the layers when I save the final tiff so a 'flatten' step doesn't help.
I need to write a line to select the background layer in P'shop that I could use in place of the ‘flatten’ step above. The total number of layers will vary but the background will always be named 'background' and be at the bottom of the layer stack. How would I write that?
The script saves as jpg but I’d like to save as 16 bpc layered tiffs. That part of the script is:
//Save as a JPEG to the outputFolder
var jpegOptions = new JPEGSaveOptions();
jpegOptions.quality = 10;
jpegOptions.embedColorProfile = false;
app.activeDocument.saveAs( File( outputFolder + "/" + activeDocument.name + ".jpg"), jpegOptions, false);
How would I rewrite that to save as 16 bpc layered tiffs?
Thanks in advance for any suggestions!
David Hoffman
The background layer of my layered, 16 bit/channel tiff files is not selected when the file is opened so the ‘crop and straighten’ command fails. I could run a separate action on the batch to leave the background selected before I run the script but I'd rather add a step in the script to select the background layer before the script calls the crop and straighten command.
I can make the script work with this ‘flatten’ step:
app.activeDocument.flatten();
but I want to retain the layers when I save the final tiff so a 'flatten' step doesn't help.
I need to write a line to select the background layer in P'shop that I could use in place of the ‘flatten’ step above. The total number of layers will vary but the background will always be named 'background' and be at the bottom of the layer stack. How would I write that?
The script saves as jpg but I’d like to save as 16 bpc layered tiffs. That part of the script is:
//Save as a JPEG to the outputFolder
var jpegOptions = new JPEGSaveOptions();
jpegOptions.quality = 10;
jpegOptions.embedColorProfile = false;
app.activeDocument.saveAs( File( outputFolder + "/" + activeDocument.name + ".jpg"), jpegOptions, false);
How would I rewrite that to save as 16 bpc layered tiffs?
Thanks in advance for any suggestions!
David Hoffman