Copy link to clipboard
Copied
Hi
I made an indesign file containes 1000 pages produced by data merge , each page contain one image
I want to use a script to rotate Images Only with certain angle ( 45 , 90 ..... etc ) Not rotating its graphic frame
Thanks
This script should do it.
function main() {
// settings:
var myAngle = prompt('Rotate all graphics by amount:', 90),
absoluteRotation = true;
if (myAngle == null)
return;
var doc = app.activeDocument,
tm = app.transformationMatrices.add({ counterclockwiseRotationAngle: Number(myAngle) }),
graphics = doc.allGraphics;
for (var i = 0; i < graphics.length; i++)
graphics[i].transform(CoordinateSpaces.PARENT_COORDINATES, AnchorPoint.CENTE...
Copy link to clipboard
Copied
Any help Here
Copy link to clipboard
Copied
So, you want help to write the script? A script which rotates every placed graphic in the document by the same amount? Or does it need to target particular graphics? I suggest you post a sample .indd document (just a few pages) with a screen shot of the final result you want. - Mark
Copy link to clipboard
Copied
Thanks For your Reply
I want script that rotates every placed graphic in the document by the same amount ( Not the graphic frame ) Except graphics in locked layers
Copy link to clipboard
Copied
This script should do it.
function main() {
// settings:
var myAngle = prompt('Rotate all graphics by amount:', 90),
absoluteRotation = true;
if (myAngle == null)
return;
var doc = app.activeDocument,
tm = app.transformationMatrices.add({ counterclockwiseRotationAngle: Number(myAngle) }),
graphics = doc.allGraphics;
for (var i = 0; i < graphics.length; i++)
graphics[i].transform(CoordinateSpaces.PARENT_COORDINATES, AnchorPoint.CENTER_ANCHOR, tm, absoluteRotation ? MatrixContent.ROTATION_VALUE : undefined);
}
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Rotate all graphics');
Note: this will set the rotate of every graphic *to* a particular angle, and running the script twice won't do anything. But if you change absolute rotation to false
absoluteRotation = false;
then it will rotate *by* the amount each time you run the script.
- Mark
Copy link to clipboard
Copied
Great thanks For you Mark
that's what I want
It worked like a charm
Thanks
Copy link to clipboard
Copied
Happy to help. 🙂
Find more inspiration, events, and resources on the new Adobe Community
Explore Now