开发者

Photoshop actions with auto rotate

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 ran开发者_开发知识库dom angle from -45 to 45 degree?


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!


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜