• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Issue with Batch processing and Actions

New Here ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

So I have a bunch of PSD files that I'm trying to resize and expand the background. The backgrounds are solid colors. The issue that I'm having is that the background layers are not named the same or the files don't have the same amount of layer.

When I go to expand the canvas size I want it to match the same color as the background. Here are my current actions list.

1. Image Size (reduced)

2. Merge Visible Layers

3. Canvas Size (Larger)

Here is where I get stuck. I want to fill the transparent canvas with the same color as the background but if I use the eye dropper tool it will do that one color. For example if one picture has a black background and I use that one to create my actions. When batch processing it will use the black color on the other files even if they have a blue background.

I need way to select the current color of the file that it's processing to fill the expanded canvas.

Any help would be greatly appreciated.

Thanks

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

It sounds like your PSD do not have a background layer. If you did when you expand the canvas size the background layer expanded canvas would be filled with the background color for it does not support transparency. If you expand a document canvas that does not have a background layer no pixels will be added the expanded canvas area will be transparent. No Layers pixels are changed layer sizes do not change. Your Action would need to use the eye dropper tool to set the  background or foreground color swatch.  Expand the canvas to the size you want. Add a new empty layer on top and fill that layer with the background color. Move the layer to the bottom of the stack and covert it to a background layer if you want.

Capture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

This may be possible only if there is constant in your files like the top left pixels have a color which you want to use to expand canvas. If that's true then try to record step with Allow Tool Recording (check this option from Actions panel menu) to sample color from top left of your file. That will set that particular color as Foreground color. In the action you should have step: Use eyedropper. This step expanded wil show you Recording Data (data)....

What you need in your action (as I have quickly develop it) will be following steps:

  1. Ensure that image is flattened
  2. Use Eyedropper to set color from top left of the image
  3. Convert Background layer to normal so you can expand canvas with transparent pixels and to add layer below
  4. Use Canvas Size to expand canvas with transparent areas
  5. Create new blank layer below
  6. Fill with Foreground color (which will be set using eyedropper in the second step)
  7. Flatten image

Here is action which I have recorded. You can re-record Use eyedropper and Canvas Size steps (Canvas Size will expand canvas to 130% in my action) Eyedropper.atn - Google Drive

So test action and tell me how it works.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

The major Issue I have is I would need to script  the process to set the color for each image.  The Eye dropper tool in actions just set the color it does not record the sampling of a point.  So I would need to sets a color sampler and get its color in a script.  Tool recording does not work for me I install Adobe's scriptlistener plug-in which disables tool recording in actions.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

For me, it works just fine it always sets color from the top left corner.

Here is the image with action which I have provided above played twice. First time it expanded canvas with color from the image. I have added custom color (black) in the top left corner and played action again. Here is the result.

sample 1.jpg

Here is landscape photo with custom color in the top left corner.

sample 3.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

I see no reason to flatten the document to destroy one's work.  However, to Automate all I had to add a little scripting the the action. I can not record tool useage Adobey Disables that feature on me,

Capture.jpg

ConvertBackground.jsx

// A Photoshop Script by JJMack's used by Photo Corners Action

// This script targets the bottom layer and makes sure it a normal layer.

// This script is supplied as is. It is provided as freeware.

// The author accepts no liability for any problems arising from its use.

/*

<javascriptresource>

<about>$$$/JavaScripts/ConvertBackground/About=JJMack's ConvertBackground.^r^rCopyright 2009 Mouseprints.^r^rScript utility for action.^rNOTE:Convert Background to normal layer if there is one!</about>

<category>JJMack's Action Utility</category>

</javascriptresource>

*/

// enable double-clicking from Mac Finder or Windows Explorer

#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events

app.bringToFront();

// ensure at least one document open

if (!documents.length) {

   alert('There are no documents open.', 'No Document');

}

// if at least one document exists, then proceed

else {

   main();

}

///////////////////////////////////////////////////////////////////////////////

// main - main function

///////////////////////////////////////////////////////////////////////////////

function main() {

try {

// declare local variables

var layers = activeDocument.layers;

activeDocument.activeLayer = layers[layers.length-1]; // Target Bottom Layer

activeDocument.activeLayer.isBackgroundLayer=0; // Make it a normal Layer

}

// display error message if something goes wrong

catch(e) { alert(e + ': on line ' + e.line, 'Script Error', true); }

}

SetSamplerColor

var orig_ruler_units = app.preferences.rulerUnits; 

app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS 

for (var s=0,len=app.activeDocument.colorSamplers.length;s<len;s++) { 

var colorSamplerRef = app.activeDocument.colorSamplers

app.foregroundColor=colorSamplerRef.color;

}  

app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings 

Capture.jpg

Capture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

It is optional step to flatten image because I believe that's what this guy wants. He has mentioned that in the initial post. With Sample All Layers in Options bar for Eyedropper when playing action everything still works fine but action will be more complex because the document may have or have not Background layer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

The problem I have is when I use the Eye Dropper tool all that the action recorder records is set foreground color the color is hard coded it is not recorded as sample x,y color and set,  Here is what is recorded

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

Here is how it should be recorded. Your step is recorded without Allow Tool Recording.

use eyedropper.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

Bojan Živković

use eyedropper.jpg

Why then does the step show Use Eyedropper followed with " Recording Data:(data)....."

When I use the eyedropper what is recorded is

pastedImage_0.png

On my Machine Allow Tool Recording is grayed out not available Adobe's Scriptlistener Plug_In disable Tool RecordingCapture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

When you record step to click somewhere using Eyedropper tool without Allow Tool Recording then you get step Set Foreground Color with hard-coded color. When Allow Tool Recording is checked then Use eyedropper step will be recorded below Set Foreground Color for the same operation using the same tool with data which should be where is clicked and perhaps settings from Options bar.

Same tool, same operation but different step recorded. The difference is in the name of additional step and what instruction or data is inside that step.

If you can get Allow Tool Recording available then check it and you will be able to record step Use eyedropper.

Just to add and those lines: when recording with Allow Tool Recording checked there will be two steps recorded: Set Foreground Color and Use eyedropper which will override Set Foreground Color step when playing action. I have deleted that step in provided action. One more useful info is that step to set Background color can be recorded. The only difference is in Alt/Opt key which should be pressed to sample color for Background color.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2018 Jun 29, 2018

Copy link to clipboard

Copied

LATEST

https://forums.adobe.com/people/Bojan+%C5%BDivkovi%C4%87  wrote

If you can get Allow Tool Recording available then check it and you will be able to record step Use eyedropper.

Correct to do that is a real hassle and not worth it IMO.

Tool Recording is not well implemented seems to fail to record changes  made to tools setting  while using tools.  And documents need to be the same size for actions to work correctly as they can. I find Tool recording is not very useful.  I see few Actions that use it on the web.

For me to get Allow tool recording I have to close Photoshop.   Uninstall Adobe Plug-in Scriptlistener.  Start Photoshop record the Action step with allow tool recording. Save the Action close Photoshop, reinstall Adobe Plug_in Scriptlistener. Start Photoshop and continue recording the action.

Little script steps can really help Actions work better. Scripting is more powerful than hard recorded Photoshop Steps. Scripting requires  you to program Photoshop.

Would your Action work on different size documents if you needed to sample the bottom Right corner not top left 0x,0y. A script can use logic to get documents size and sample any corner easily

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines