How do I change a canvas orientation from landscape to portrait and vice versa?

For instance: There is an option with artboard/page (in AI and PS / ID) to change the orientation, but what I want to do with canvas, does not exist.

** It's obvious that canvas size values exchange makes it possible, but it's a manual procedure. I need a more-automaton method.

*** I think it's scriptable by using "Canvas Size" feature. The script could replace the values of width and height with each other.


If don't care about the crop, a simple script:

var doc = activeDocument;
var w = doc.width.as('px');
var h = doc.height.as('px');
var bottomLayer;

try {
    bottomLayer = doc.backgroundLayer;
    bottomLayer.isBackgroundLayer = false;
} catch(e) {}

doc.resizeCanvas(new UnitValue(h, 'px'), new UnitValue(w, 'px'));

It'll also make a BG layer non-BG layer.

| improve this answer | |
  • Sorry for delayed "Thank you" comment! This script works very fine and is exactly what I need, and even maybe some body else's need too! It won't crop anything, I mean no pixels got cleared after canvas changed and all layers left untouched! Very Good Work... Thank you alot ;) – Roozbeh E Mar 4 at 9:45
  • 1
    @RoozbehE You're welcome. Yes I think I wrote about the crop before I added the part where background layer is converted to a normal floating layer, so no cropping is happening. – Sergey Kritskiy Mar 4 at 10:00

You are correct. Canvas size, and merely swap the width and height numbers.

While it's possible to merely rotate an image that is quite different than rotating the canvas. I don't think there's any "quick flip" method for the canvas orientation.

| improve this answer | |
  • For sure it's different that rotating image, and also when change orientation, it could drop some part of objects or image off the canvas. It's good to make a script that converts "Background Layer" to normal layer and then continue it's job. – Roozbeh E Feb 26 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.