Skip to main content
This topic has been closed for replies.

2 replies

c.pfaffenbichler
Community Expert
Community Expert
March 4, 2015

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

if (myDocument.width < myDocument.height) {

  myDocument.rotateCanvas(90)

  }

else {

  }

};

JJMack
Community Expert
Community Expert
March 4, 2015

c.pfaffenbichler wrote:

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

if (myDocument.width < myDocument.height) {

  myDocument.rotateCanvas(90)

  }

else {

  }

};

For the above code to work you would need to insure Photoshop units were set to something other than percent.  For when Photoshop Units are set to percent the statement "if (myDocument.width < myDocument.height) " would never rotate the canvas it would alway be "if (100% < 100%)" always equal been burned by that...

JJMack
c.pfaffenbichler
Community Expert
Community Expert
March 4, 2015

Good point.

c.pfaffenbichler
Community Expert
Community Expert
March 4, 2015

Please elaborate.

Do you want to rotate portrait images, add canvas, …?

Roopa aniAuthor
Known Participant
March 4, 2015

i need to rotate image to Landscape

c.pfaffenbichler
Community Expert
Community Expert
March 4, 2015

So what is giving you problems?

The rotation or determining whether the image is portrait?