Rotate+Crop (CS2 ... CS5)

Use this Forum for Beta-Testing your Photoshop Scripts

Moderators: Tom, Kukurykus

autiokari

Rotate+Crop (CS2 ... CS5)

Post by autiokari »

Rotate+Crop rotates the canvas and then calculates the largest rectangle that has all four corners on the borders of the image data and then crops to that. It has two modes:

(1) activeLayer is the Background (and not a layer): User first draws the Measure Tool to indicate the desired horizontal or vertical alignment and then starts the script.

(2) activeLayer is a layer (and not the Background): User first starts the script, the script then shows the Transform Tool and wait that the user rotates the layer using the mouse. During this the user can activate the grid or draw guides for more accurate results. Note: the canvas will then be rotated and cropped in this case also, not the layer.

It is fast and accurate as it calculates the transforms (does not rely on selecting the extra surface area that appears after the rotation operation). Has been performing flawlessly in five computers with CS5 and two with CS2 since last summer. But if any issues arises I'll try to fix them, just post to this thread.

In case (1) it takes the rotation angle from the Rotate Canvas dialog, this is possible in CS2 only by letting the script to process the Rotate Canvas dialog in "ALL" mode. That would normally require extra effort from the user (to click the OK button of that dialog or to press the Return keyboard key) so the script will instead send the Return key-event to that dialog. It does this by a vbs script, this script will appear in the same folder where the script resides. Also an ini file will be saved to the same folder, it contains the location of the infobox so that it will always be shown at the location where it was lastly moved by the user.

Just a convenient tool. Not a demonstration of scripting skills (which I do not possess).

BR,
Timo
Nick

Rotate+Crop (CS2 ... CS5)

Post by Nick »

Great work!