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

How do I crop/remove an extra white space around on image in InDesign script?

Contributor ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

Hi All,

 

How do I crop/remove an extra white space around on image in InDesign script? Please see below your reference.

 

crop.png

 

This is possible or not? Please suggest to me, friends

 

Thanks,

karthik S

 

 

TOPICS
Scripting

Views

2.6K

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
Community Expert ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

An image is a graphic file inside a rectangle. You crop the image by changing the geometric bounds of the rectangle. For example, to crop an image by 6 millimeters on all sides, do this (assuming your measurement units are millimeters):

 

gb = app.selection[0].geometricBounds;
app.selection[0].geometricBounds = [gb[0]+6, gb[1]+6, gb[2]-6, gb[3]-6];

 

P.

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 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Hi @Peter Kahrel 

Totally agree with the solution that you have provide , please help me with script 

I have placed imagefile in rectangular frame having bounds (x=800.524 mm, y=11.194 mm,w=200.003 mm,H=79.153 mm)

Now i want to crop my image (by changing geometric bound of rectangular frame having bound (x=800.524 mm, y=11.194 mm,w=33.35 mm,H=79.153 mm)

 

Thanks in advance !!

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 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

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
Community Expert ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

geometric bounds are top, left, bottom, and right. So with your data,

gb = app.selection[0].geometricBounds;
app.selection[0].geometricBounds = [
  11.194,
  800.524,
  11.194 + 79.153,
  800.524 + 33.35
];

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
Contributor ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

Thanks! Perter Kahrel

 

Also, my main concern, I need to crop for the left and right white space. Please see my screenshot (Please see "Crop" bottom of the left and right text)  this type of cropping, I want to do.

 

This is possible?

 

 

Thanks in Advance,

Karthik S

 

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
Community Expert ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

Well, sure. Do you know geometricBounds? They are the top, left, bottom and right of a frame, in that order. So if you want to crop left and right, you change the second (left) and fourth (right) values:

 

app.selection[0].geometricBounds = [gb, gb[1]+6, gb[2], gb[3]-6];

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
Contributor ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

One more Thanks! Perter Kahrel

 

I want to like crop image(this is group image) below: Placed screenshot for your reference.

 

crop2.png

 

Thanks, 

Karthik S

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
Community Expert ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

You didn't answer my question. If you're looking for someone to write a script for you, you should state that clearly. And you should also state clearly what exactly you want: from your screen shot it's not clear how much should be taken off.

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
Community Expert ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

LATEST

I'm pretty sure he / she is looking for an automatic way to crop white space 😉 like you can do in Photoshop when you select around the object 😉 but of course is not possible.

 

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