• 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 resize an image layer to the same size as the width of the document respecting its aspect ratio.

Engaged ,
Nov 12, 2016 Nov 12, 2016

Copy link to clipboard

Copied

How to resize an image layer to the same size as the width of the document respecting its aspect ratio.

Untitled-2.jpg

TOPICS
Actions and scripting

Views

1.2K

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

Guide , Nov 12, 2016 Nov 12, 2016

#target photoshop;

if(documents.length){

var doc = app.activeDocument;

var layer = doc.activeLayer;

var per = doc.width.value/(layer.bounds[2]-layer.bounds[0])*100;

layer.resize(per,per);

doc.selection.selectAll();

align('AdCH');

align('AdCV' );

doc.selection.deselect();

}

function align(method){

var desc = new ActionDescriptor();

var ref = new ActionReference();

ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );

desc.putReference( charIDToTypeID( "null" ), ref

...

Votes

Translate

Translate
Adobe
Guide ,
Nov 12, 2016 Nov 12, 2016

Copy link to clipboard

Copied

#target photoshop;

if(documents.length){

var doc = app.activeDocument;

var layer = doc.activeLayer;

var per = doc.width.value/(layer.bounds[2]-layer.bounds[0])*100;

layer.resize(per,per);

doc.selection.selectAll();

align('AdCH');

align('AdCV' );

doc.selection.deselect();

}

function align(method){

var desc = new ActionDescriptor();

var ref = new ActionReference();

ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );

desc.putReference( charIDToTypeID( "null" ), ref );

desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );

executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );

};

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
Engaged ,
Nov 12, 2016 Nov 12, 2016

Copy link to clipboard

Copied

LATEST

Perfect, thanks ""! How nice that you came back SuperMerlin, I missed you friend ...

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