具有自动旋转功能的 Photoshop 动作

发布于 2024-08-31 11:51:11 字数 84 浏览 2 评论 0原文

我构建了用于创建图像拇指的操作,并且我想添加到操作末尾自动旋转到我的拇指。 我的问题是:如何添加从 -45 到 45 度的随机角度旋转?

I build my action for create image thumbs, and I want add to the end of action auto rotate to my thumb.
My question is: How add rotate with random angle from -45 to 45 degree?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

老街孤人 2024-09-07 11:51:11

您可以通过 Adob​​e Script 自动旋转图像:

    if (!app.documents.length > 0) {
    alert("No active document");
    }
    else {
    var docRef = app.activeDocument;
    var docWidth = docRef.width.as("px");
    var docHeight = docRef.height.as("px");

    if (docWidth > docHeight) {
    docRef.rotateCanvas(90);
    }
    }

可以通过以下方式生成随机数:

this.rawValue = Math.random() * (45 - 1) + 1;

我还没有完成足够的 Adob​​e Script 来告诉您如何将所有这些组合在一起,但我相信您足够聪明!

有用的网站:http://www.photoshopsupport.com/tutorials/jennifer/photoshop -scripts.html

享受!

You can rotate an image automatically via an Adobe Script:

    if (!app.documents.length > 0) {
    alert("No active document");
    }
    else {
    var docRef = app.activeDocument;
    var docWidth = docRef.width.as("px");
    var docHeight = docRef.height.as("px");

    if (docWidth > docHeight) {
    docRef.rotateCanvas(90);
    }
    }

Random numbers can be generated with:

this.rawValue = Math.random() * (45 - 1) + 1;

I've not done enough Adobe Script to tell you how to put this all together, but I'm sure you are clever enough!

Helpful site: http://www.photoshopsupport.com/tutorials/jennifer/photoshop-scripts.html

Enjoi!

怂人 2024-09-07 11:51:11

对另一个答案感到抱歉,我不想让我的另一个答案变得庞大且难以阅读。

我已经尝试过(非常糟糕)脚本(并且,郑重声明,它还没有经过测试或任何东西,我对此并不擅长)

if (!app.documents.length > 0) {
    alert("No active document"); //no document?! whats happening?!
} else {
    var docRef = app.activeDocument;
    var docWidth = docRef.width.as("px");
    var docHeight = docRef.height.as("px");

    if (docWidth > docHeight) { //if width is greater than height
        PlusMinus.rawValue = Math.random() * (2 - 1) + 1; //GET 1 OR 2
        if (PlusMinus.rawValue == 1) {
            deLimit = "-"; //set minus if its a 1
        } else {
            deLimit = "+"; //set plus if its a 2
        }
        Angles.rawValue = Math.random() * (45 - 1) + 1; //GET NUMBER FROM 1-45
        docRef.rotateCanvas(deLimit+Angles);
    }
}

我相信您会从中得到启发!

Sorry for another answer, I didn't want to make my other one massive and unreadable.

I have attempted (VERY BADLY) the script (and, for the record, it's not been tested or anything and I'm not great at this)

if (!app.documents.length > 0) {
    alert("No active document"); //no document?! whats happening?!
} else {
    var docRef = app.activeDocument;
    var docWidth = docRef.width.as("px");
    var docHeight = docRef.height.as("px");

    if (docWidth > docHeight) { //if width is greater than height
        PlusMinus.rawValue = Math.random() * (2 - 1) + 1; //GET 1 OR 2
        if (PlusMinus.rawValue == 1) {
            deLimit = "-"; //set minus if its a 1
        } else {
            deLimit = "+"; //set plus if its a 2
        }
        Angles.rawValue = Math.random() * (45 - 1) + 1; //GET NUMBER FROM 1-45
        docRef.rotateCanvas(deLimit+Angles);
    }
}

I'm sure you will get the idea from that!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文