Skip to main content
Participant
September 5, 2022
Answered

rotation

  • September 5, 2022
  • 3 replies
  • 660 views

how to rotate an image with random rotation within min ... max... to apply to a large number of psd files. I want to make an action .when running this action it can rotate the image automatically without repeating with most of the file.

Note: the rotate action does not repeat on many different psd files, not random rotate multiple objects in one psd file

This topic has been closed for replies.
Correct answer jazz-y

rotate only active layer:

 

var min = -90, max = 180;
activeDocument.activeLayer.rotate (min + Math.random()*(max-min))

 

 rotate whole image canvas:

 

var min = -90, max = 180;
activeDocument.rotateCanvas (min + Math.random()*(max-min))

 

Save the code to a text file, change the extension from .txt to .jsx. While recording an action, select the menu item File -> Scripts -> Browse and select this file. Its call will be recorded in an action and you can use it during batch processing.

3 replies

jazz-yCorrect answer
Legend
September 5, 2022

rotate only active layer:

 

var min = -90, max = 180;
activeDocument.activeLayer.rotate (min + Math.random()*(max-min))

 

 rotate whole image canvas:

 

var min = -90, max = 180;
activeDocument.rotateCanvas (min + Math.random()*(max-min))

 

Save the code to a text file, change the extension from .txt to .jsx. While recording an action, select the menu item File -> Scripts -> Browse and select this file. Its call will be recorded in an action and you can use it during batch processing.

Bojan Živković11378569
Community Expert
Community Expert
September 5, 2022

You can use Conditional Actions for some, limited variations in some cases. If you want "random" then I believe it is achievable only using script, I will tag experts who may be able to help you.

 

@jazz-y @c.pfaffenbichler @r-bin @Stephen Marsh 

Participant
September 5, 2022

how to rotate an image with random rotation within min ... max... to apply to a large number of psd files. I want to make an action .when running this action it can rotate the image automatically without repeating with most of the file.

Note: the rotate action does not repeat on many different psd files, not random rotate multiple objects in one psd file

Participant
March 13, 2023

To rotate an image with a random rotation within a minimum and maximum range, you can follow these steps:

  1. Choose a programming language to use for the task. Some common options include Python, Java, or C++.

  2. Read in the PSD file that you want to rotate. You can use a library such as Pillow or OpenCV to do this.

  3. Generate a random rotation angle within the desired range (minimum and maximum angles). You can use a random number generator function in your programming language to do this.

  4. Apply the rotation to the image using a rotation function from your image library. Make sure to specify the rotation angle that you generated in step 3.

  5. Save the rotated image as a new PSD file or overwrite the original file if desired.

  6. Repeat steps 2-5 for all of the PSD files that you want to rotate...