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

Change Smart Object Size

Participant ,
Jun 07, 2023 Jun 07, 2023

Copy link to clipboard

Copied

Hello guys, I am trying to make an script where I can change the size of the current layer

but it is an smart object, is that possible?

TOPICS
Actions and scripting

Views

99

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

Participant , Jun 08, 2023 Jun 08, 2023

I've resolved my problem with the next code:

 

offsetX = 200 - app.activeDocument.activeLayer.bounds[0].as("px");
offsetY = 500 - app.activeDocument.activeLayer.bounds[1].as("px");
app.activeDocument.activeLayer.translate(offsetX, offsetY);

 

200 and 500 are the coordinates set in pixels in my case.

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 08, 2023 Jun 08, 2023

Copy link to clipboard

Copied

One can transform (scale, rotate, …) a Smart Object via Script so what is giving you problems? 

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
Participant ,
Jun 08, 2023 Jun 08, 2023

Copy link to clipboard

Copied

LATEST

I've resolved my problem with the next code:

 

offsetX = 200 - app.activeDocument.activeLayer.bounds[0].as("px");
offsetY = 500 - app.activeDocument.activeLayer.bounds[1].as("px");
app.activeDocument.activeLayer.translate(offsetX, offsetY);

 

200 and 500 are the coordinates set in pixels in my case.

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