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

Clipping a Rectangle using Extendscript?

New Here ,
Oct 14, 2022 Oct 14, 2022

I'm trying to write a function that takes two possibly overlapping rectangles and returns an array of rectangles that cover the area of rectangle A, but exclude area of rectangle B.

 

 rect A= x1="800.7" x2="1000.35" y1="11.37" y2="90.17"

rect B= x1="833.967 " x2="1000.697" y1="11.37" y2="90.17"T

 

i want to place my image in the resulting rectangle

result rect= rect A- rect B

i am available to get the bounds for both the reactangles but not sure how to get the result reactangle and also how to place image in the resultanted rectangle please the attachment for proper understanding

TOPICS
Scripting
4.4K
Translate
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

Community Expert , Oct 17, 2022 Oct 17, 2022

Hi @codevita , I saw your note. The container frames’s geometricBounds are relative to the page not the image—[Y1, X1, Y2, X2]:

 

 

//the amount to clip
var clipX = 85;

//alert the current selection’s bounds
var b = app.selection[0].geometricBounds;
alert("Selection’s Bounds: " + b);

//add the clip amount to the x1 value  (b[1]+clipX) moves the left edge of the frame to the right
app.selection[0].geometricBounds = [b[0], b[1]+clipX, b[2], b[3]]

//alert the new bounds
alert("Selection’s New Bo
...
Translate
New Here ,
Oct 18, 2022 Oct 18, 2022

@rob day 

let me explain it more we image which fit in the frame (pos) like:

sukriti29_0-1666157383467.png

accepetd result:(after cropping)

sukriti29_1-1666157466876.png

which is crop according to the clip bounds:

I hope i am clear to you ..

 

Thanks for your patience!

Translate
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 ,
Oct 19, 2022 Oct 19, 2022

@rob day  plz suggest something

Translate
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
Community Expert ,
Oct 19, 2022 Oct 19, 2022

You would have to subtract the clip amount from the x2 parameter

Translate
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 ,
Oct 19, 2022 Oct 19, 2022

@rob day hey Rob is there any crop() for image or any sort of way crop them??

Translate
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
Community Expert ,
Oct 19, 2022 Oct 19, 2022

No, you can only adjust the container frame

Translate
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 04, 2022 Nov 04, 2022
LATEST

Hi @rob day 

 

Resume my finding on this same issue , can we have any script which clip the image using rectangular frame.

with bounds (X=800.524 mm, Y=11.194 mm,W=33.35 mm,H=79.153 mm)

Much appreciated!!

Translate
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