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

Center object and give it a fixed measure automatically, using batch...

New Here ,
Jan 10, 2017 Jan 10, 2017

Copy link to clipboard

Copied

Hi all readers and helpers,

Very often i need to resize and move (centre) the object like this.

Screen Shot 2017-01-11 at 9.08.11 .pngScreen Shot 2017-01-11 at 9.12.28 .png

When i register this action and try to use in batch... PS repeats the same "movement" that first object did. It doesn't work, cause I have objects in different places on this white background and of different sizes. Like this for example:

Screen Shot 2017-01-11 at 9.33.49 .png

Question is:

How to "tell" PS that he should make this "transform free" rectangle to be of absolute measures (ex. fixed "L" and "A" proportional to it) and that "centre-cross" of free transformation is where my guidelines cross? I need this action for automatic resize of object with "batch..." tool.

Many thanks in advance.

Views

805

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

correct answers 1 Correct answer

Community Expert , Jan 11, 2017 Jan 11, 2017
could u explain what u mean by: ''clip the document to the Layer''.

Hide all other Layers and use Image > Trim > Transparent Pixels for example.

But I think the Smart Object approach is preferable.

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 10, 2017 Jan 10, 2017

Copy link to clipboard

Copied

I see two alternatives:

• do it with JavaScript

• get »fancy« with the Action – meaning you may have to clip the document to the Layer, use Image Size to get the target width, then increase the Canvas to the previous size or better yet convert the Layer to a Smart Object, open it and change the Image Size without resampling, save and close

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
New Here ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

Many thanks c.pfaffenbichler,

  • have no idea about JavaScript. can I learn it fast? (no clue about programming too)

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
New Here ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

from the second option, ok i think i get the idea more or less but could u explain what u mean by: ''clip the document to the 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 ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

could u explain what u mean by: ''clip the document to the Layer''.

Hide all other Layers and use Image > Trim > Transparent Pixels for example.

But I think the Smart Object approach is preferable.

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 ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

I guess JavaScript is, compared to some other languages, fairly simple but how quickly you could learn it and Photoshop’s DOM and AM I cannot say.

Have you tries the Smart Object work-around in an Action yet?

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 ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

The following action screenshot presumes that the current targeted layer content requires:

1) To be horizontally and vertically centred on the canvas

2) To be resized to a fixed pixel width, with the height proportionally resized

action.png

The automated placement could be made elsewhere by transforming the selection which is used by the align command.

The script referenced in the final step of the action is below. Line 12 is where the pixel value can be changed, in this case the target is 600px. I can't script, however looking at lines 06 and 12 it would appear to be possible to change this to another unit of measure, such as inches etc:

// https://forums.adobe.com/thread/988084

#target photoshop 

function main(){ 

if(!documents.length) return; 

var startRulerUnits = app.preferences.rulerUnits; 

app.preferences.rulerUnits = Units.PIXELS; 

var doc = activeDocument; 

var res= doc.resolution; 

var LB = activeDocument.activeLayer.bounds; 

var Width= LB[2].value - LB[0].value; 

var onePix = 100/Width; 

var newSize = onePix * 600; 

doc.activeLayer.resize( newSize , newSize, AnchorPosition.MIDDLECENTER);  

app.preferences.rulerUnits = startRulerUnits; 

main();

If the height of the layer was they key step, then (line 13):

// https://forums.adobe.com/thread/988084

// Change Height to 930px

#target photoshop 

function main(){ 

if(!documents.length) return; 

var startRulerUnits = app.preferences.rulerUnits; 

app.preferences.rulerUnits = Units.PIXELS; 

var doc = activeDocument; 

var res= doc.resolution; 

var LB = activeDocument.activeLayer.bounds; 

var Height= LB[3].value - LB[1].value; 

var onePix = 100/Height; 

var newSize = onePix * 930; 

doc.activeLayer.resize( newSize , newSize, AnchorPosition.MIDDLECENTER);  

app.preferences.rulerUnits = startRulerUnits; 

main();

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
Advocate ,
Jan 11, 2017 Jan 11, 2017

Copy link to clipboard

Copied

LATEST

You can also use simpler method.

Start with your image (any size) and layer with your artwork.

THEN:

  1. Add new empty Layer (CTRL+Alt+Shift+N)
  2. Using Alt+Backspace fill this new layer with your foreground (any!) color - color is not important here
  3. Select this new layer and also your artwork layer. Be sure you selected ONLY layers
  4. Then with Move Tool selected (V) choose Vertical and Horizontal center inoptions panel on top of your screen
  5. Remove previously added layer

Thats all

It works fine and you can record it with action

Pawel

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