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

How to? Resizing an image using the transform tool to a specific pixel-size...........in an action.

Explorer ,
Sep 14, 2019 Sep 14, 2019

Copy link to clipboard

Copied

I have a template in which I want to place several images. All these images have a different pixel-size and I want them all to be resized to 1080 pixels wide.

When I make an action using the Transform tool it records that action with a percentage. For example, when I place an image which is 2160 pixels wide and I record the action so that the image is transformed to 1080 pixels wide, the action records that the transformation is done by 50%.

But when I place a second image (say 3000 pixels wide) and I run the action, the image gets transformed to 1500 pixels wide (50%), but that's not what I want, I want that second image to be 1080 pixels wide.

So how can I make the action record a transformation to 1080 pixels wide in stead of resizing it to 50% ?

Thanks in advance for your help.

TOPICS
Actions and scripting

Views

535

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 , Sep 14, 2019 Sep 14, 2019

A scripted solution:

 

#target photoshop
(function (){
    var startRulerUnits = app.preferences.rulerUnits;  
    app.preferences.rulerUnits = Units.PIXELS;  
    var bounds = activeDocument.activeLayer.bounds;  
    var width = bounds[2].value - bounds[0].value;
    var newSize = (100 / width) * 300;  // 300px
    activeDocument.activeLayer.resize(newSize, newSize, AnchorPosition.MIDDLECENTER);
    app.preferences.rulerUnits = startRulerUnits;  
})();

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

...

Votes

Translate

Translate
Adobe
Community Expert ,
Sep 14, 2019 Sep 14, 2019

Copy link to clipboard

Copied

Try this action, it offers 2 different methods and you can turn off the dialog to use a fixed non-interactive size:

 

https://www.dropbox.com/s/h5d21n85aoh44p1/Resize%20Current%20Layer%20to%20Specific%20Pixel%20Size%20...

 

resize-to-px.png

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 ,
Sep 14, 2019 Sep 14, 2019

Copy link to clipboard

Copied

A scripted solution:

 

#target photoshop
(function (){
    var startRulerUnits = app.preferences.rulerUnits;  
    app.preferences.rulerUnits = Units.PIXELS;  
    var bounds = activeDocument.activeLayer.bounds;  
    var width = bounds[2].value - bounds[0].value;
    var newSize = (100 / width) * 300;  // 300px
    activeDocument.activeLayer.resize(newSize, newSize, AnchorPosition.MIDDLECENTER);
    app.preferences.rulerUnits = startRulerUnits;  
})();

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Originally from:

https://graphicdesign.stackexchange.com/questions/58812/specific-resize-layer-action

 

 

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
Explorer ,
Sep 14, 2019 Sep 14, 2019

Copy link to clipboard

Copied

Eh.....this works......perfect. Thank you so much for this quick reply and solution.

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 ,
Sep 14, 2019 Sep 14, 2019

Copy link to clipboard

Copied

LATEST
The action should work 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