• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to rotate image inside a frame

New Here ,
Nov 02, 2016 Nov 02, 2016

Copy link to clipboard

Copied

Hello,  reaching out before I fall completely down the rabbit hole. 

I have a script that downloads puzzles and comics daily.  I have one puzzle that when downloaded, needs to be placed 90CCW.  A sample of the code i'm trying is here:

                // LA TIMES SUNDAY

                if (pageItem.label == "LA_TIMES_SUNDAY_CROSSWORD")

                try{

                    name = "20" + myDate.text + "pzsxw-a.tif"

                    var myFile = new File(imagePath+name);

  if (myFile.exists)

                    {

  pageItem.place(myFile);

  pageItem.rotationAngle = 90;

  // pageItem.fit(FitOptions.CONTENT_TO_FRAME);

                        }

                   

This works but it moves my frame way up and resizes it.  Any ideas how I can only have the image rotate within the frame, keeping everything else in the template static?

Hope this makes sense.

Doug

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Nov 03, 2016 Nov 03, 2016

Hi Doug

You can use

var tm = app.transformationMatrices.add(undefined, undefined, undefined, 90);

pageItem.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, tm);

instead of

pageItem.rotationAngle = 90;

HTH

Trevor

Votes

Translate

Translate
Guru ,
Nov 03, 2016 Nov 03, 2016

Copy link to clipboard

Copied

Hi Doug

You can use

var tm = app.transformationMatrices.add(undefined, undefined, undefined, 90);

pageItem.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, tm);

instead of

pageItem.rotationAngle = 90;

HTH

Trevor

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 03, 2016 Nov 03, 2016

Copy link to clipboard

Copied

Easier to remember is

app.layoutWindows[0].transformReferencePoint = AnchorPoint.CENTER_ANCHOR;

pageItem.rotationAngle  = 90;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 03, 2016 Nov 03, 2016

Copy link to clipboard

Copied

LATEST

Thanks so much Trevor.

Worked like a charm!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines