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

How can I rotate all the text layers in a PSD document by Java Script

Guest
Feb 05, 2017 Feb 05, 2017

Copy link to clipboard

Copied

How can I rotate all the text layers in a PSD document by Java Script, Instead of, rotate the text layers one by one.

This is a pressing problem in the Engineering plan drawing. Thanks anyway!

                                                           by a Green hand

TOPICS
Actions and scripting

Views

1.5K

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

Advocate , Feb 06, 2017 Feb 06, 2017

Hi buddy.

Try this script. Define the angle you want to rate and you should be good.

// Rotate all text layer by a given angle.

// Script by Tomas Sinkunas www.rendertom.com

(function(){

    #target photoshop

    // Define the angle.

    var angle = 180;

  

    // Collect all text layers in the document

    var textLayers = getTextLayers(app.activeDocument);

    // Loop through all text layers in the document

    for (var t = 0, tl = textLayers.length; t < tl ; t ++) {

        // Rotate the layer

        tex

...

Votes

Translate

Translate
Adobe
LEGEND ,
Feb 05, 2017 Feb 05, 2017

Copy link to clipboard

Copied

I've moved this from Photoshop General Discussion​ to Photoshop Scripting

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 ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

It relatively easy to process all text layers in a document with a script.  However, rotating text layers well may be hard. Text can be a line or paragraph rotation can be done from any rotation point and can rotate text off canvas.  Text can be very complex to deal with.

JJMack

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
Guest
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

LATEST

In the same way, rotate all the text layers whithin one document will be easy in AutoCAD software. But Adobe Photoshop Is another case. Maybe, Adobe Corp should deliberate what to do tomorrow.......

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 ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

Hi buddy.

Try this script. Define the angle you want to rate and you should be good.

// Rotate all text layer by a given angle.

// Script by Tomas Sinkunas www.rendertom.com

(function(){

    #target photoshop

    // Define the angle.

    var angle = 180;

  

    // Collect all text layers in the document

    var textLayers = getTextLayers(app.activeDocument);

    // Loop through all text layers in the document

    for (var t = 0, tl = textLayers.length; t < tl ; t ++) {

        // Rotate the layer

        textLayers.rotate (angle, AnchorPosition.MIDDLECENTER);

    }

    function getTextLayers (doc, layers) {

        layers = layers || [];

        for (var i = 0, il = doc.layers.length; i < il; i ++) {

            if (doc.layers.typename == "LayerSet") {

                getTextLayers(doc.layers, layers)

            } else {

                if (doc.layers.kind == "LayerKind.TEXT") {

                    layers.push(doc.layers)

                }

            }

        }

        return layers

    }

})();

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
Guest
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

Tanks anyway!  I will have a tray. in addition,  I learn JS just a short time, So, I must Try and Try ...

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