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

Graphic frame bounding box

Guide ,
Nov 24, 2016 Nov 24, 2016

Copy link to clipboard

Copied

Hi,

I need to know which image have extended graphic frame.

Screen Shot 2016-11-24 at 5.54.27 PM.png

Below coding is working fine for me:

app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN; 

app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.POINTS;  

app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;  

var link, image, frame; 

var doc = app.activeDocument; 

var graphics = doc.allGraphics; 

var graphicsname=[]

for (var i = 0; i < graphics.length; i++) { 

link = graphics.itemLink; 

image = link.parent; 

frame = image.parent; 

image0=Math.round(image.geometricBounds[0]);

image1=Math.round(image.geometricBounds[1]);

image2=Math.round(image.geometricBounds[2]);

image3=Math.round(image.geometricBounds[3]);

frame0=Math.round(frame.geometricBounds[0]);

frame1=Math.round(frame.geometricBounds[1]);

frame2=Math.round(frame.geometricBounds[2]);

frame3=Math.round(frame.geometricBounds[3]);

if((image0>frame0) || (image1>frame1) || (image2<frame2) || (frame3 >image3)){

    graphicsname.push(link.name)

}

alert(graphicsname.join("\n"))

But the problem is when the image is shear or rotated in the graphic frame, it throw as error. Even the image box does not have empty space. Any suggestion i move forward?

Screen Shot 2016-11-24 at 5.56.05 PM.png

Also if you have suggestions to improve my above coding that also great.

Thanks,

K

TOPICS
Scripting

Views

5.5K

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
Guide ,
Nov 29, 2016 Nov 29, 2016

Copy link to clipboard

Copied

Well, I probably meant “The DOM provides no simple way to access a visible bounding box disregarding stroke weight.” 😉

That is, BoundingBoxLimits enumeration only provides geometricPathBounds and outerStrokeBounds, not innerStrokeBounds.

Anyway for the specific tool we are discussing the “inner-stroke” box corners are surely computable from the outer-stroke coordinates, based on strokeWeight. Roughly, increasing EPSILON by strokeWeight should do the trick—whatever StrokeAlignment.

@+

Marc

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
Advocate ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

LATEST

Hello Marc and Uwe,

Uwe linked me here and I stubled upon Indiscrips ​leading here.
It always bugged me that FitFrame2Content doesnt work with rotations, and my collegues often turn images by ~1.78° and if I FF2C it happened, i dont see that the image gets cropped a bit.

So, even if this script isnt perfect for all situations (i read the stroke-thing being a problem to tackle simple) but as for now, it would help alot to exchange InDesigns own FF2FC with it.

I dont see Adobe ringing Marc and Uwes door, but Adobe should at least be ashamed leaving this halfbaked for so long, dont you think?
So, how much alternation has to go into the code, to, lets say, take over InDesigns own FF2C?

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 29, 2016 Nov 29, 2016

Copy link to clipboard

Copied

tpk1982 wrote:

But it always throws the alert KO even the image in correct position.

Hi Karthi,

I hope you realised that if you test on a selection, that the image and not the container frame should be selected when using Marc's script…

Regards,
Uwe

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
Guide ,
Nov 29, 2016 Nov 29, 2016

Copy link to clipboard

Copied

Hi Uwe,

Yes it is working fine after i selected the image and not container...

@Jarek: I tried the coding you provided as same KO results coming. Is it possible to do this for all graphics instead of selecting and check?

Now i am confused whom to give correct answer.. 

Thank you all who answering this thread.. Really appreciated and learnt lot

Thanks,

Karthi

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
Guide ,
Nov 29, 2016 Nov 29, 2016

Copy link to clipboard

Copied

Hi Jarek,

Working fine now

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 29, 2016 Nov 29, 2016

Copy link to clipboard

Copied

Hi Karthi,

let's wait what Marc is saying about my "special" case where the result is a false negative.
You could test this case as well. I linked my test documents.

Regards,
Uwe

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
Guide ,
Nov 29, 2016 Nov 29, 2016

Copy link to clipboard

Copied

Hi Uwe,

Yes i am now in office and they are not allowing to download files from Dropbox. I am trying the same case with a sample document here.

Regards,

Karthi

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