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

Is there a way to calculate the area of a shape?

Engaged ,
May 09, 2007 May 09, 2007

Copy link to clipboard

Copied

I work in toy packaging and the size of the warning we have to use is dictated by the size of the package. On most items, it's pretty straight forward, LxW... But that doesn't always work, as the packaging isn't always that simple. Is there a way to get Illustrator to give me the area of a shape?

Thanks!
TOPICS
Feature request

Views

174.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
Adobe
New Here ,
Sep 01, 2007 Sep 01, 2007

Copy link to clipboard

Copied

JET:

That is VERY cool!

Hmmm, now, another scripting language to crack...just enough to get the square points text on the clipboard: that would do it.

Thanks VERY much!

Henry

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
LEGEND ,
Sep 02, 2007 Sep 02, 2007

Copy link to clipboard

Copied

> ...just enough to get the square points text on the clipboard: that would do it.

Henry,

Download the .zip again from the same link as given above. It now contains an additional script, JET_AreaLabel.jsx. That script works like the first, except that instead of just displaying the area in an alert, it also:

Creates a PointType textFrame centered on the bounding box of the selected path, containing the text of the alert. (You can delete the unwanted units of measure.)

Copies just the value (no additional text) of the area in square points to the clipboard. You can then paste that value into another program. (For example, you could set up an Excel worksheet with cells to calculate the conversion to acres, based on the drawing scale(s) you are using.)

The script uses the app.cut() function new to CS3, so it may not work in earlier versions.

> Worth mentioning: I had _no_ idea of the number and variety of plug-ins available for Illustrator

Also worth mentioning: If this is a frequent kind of work for you, I really don't know why you are doing it in Illustrator. Illustrator's feature set is practically antagonistic toward drawing to scale. For example, you could be doing the same work in Canvas, where you could see both the area and perimeter of the path always displayed right there in the Object Specs, and use live dimension tools--all with values expressed in true-measure at the actual scale you are using in your drawing.

JET

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 ,
Aug 07, 2011 Aug 07, 2011

Copy link to clipboard

Copied

Just wanted to thank you for the script.  Saved the day and a lot of work for me !

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 ,
Sep 03, 2007 Sep 03, 2007

Copy link to clipboard

Copied

JET:

Wow, talk about service. THAT is exactly what I need.

And you've taught me how to fish -- those are great examples, and I can take the scripting from here if I need any more adjustments, which I probably do not.

Thanks for the recommendation for Canvas, but I should not need to do this kind of task routinely. Once I get a set of values for a total of about 6 geographic areas represented in exactly two aerial photos, I should not need to estimate areas enclosed by paths ever again. All I need is decent estimates of the sizes of these areas -- I'm not looking for perfection, just confirmation of some parameters I already have.

Since you mention it, on a completely different project, I'm working with maps -- tracing old maps of towns Eastern Europe to help understand and document the period between World War I and World War II. (My grandparents were from Old Poland, now Belarus.) In my search through Illustrator add-ins I saw some potentially useful functions that might help with that work.

(Over the course of my professional life, I've definitely seen lots of cases where one is tempted to adapt a particular software tool to a new use, things get out of hand, and one ends up doing things never intended. [To show my age, here's my favorite example: Writing an full-screen editor in the command-line editor TECO.] Almost certainly there are cartographic tools yet more a suited to my mapping tasks -- but I own Illustrator, I'm somewhat adept with its simple functions, and --even if the cartographic software is no- or low-cost, I'm not certain I could learn a radically different software package for that purpose. OK... Enough philosophy, right?)

Thanks!

Henry

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
LEGEND ,
Sep 04, 2007 Sep 04, 2007

Copy link to clipboard

Copied

> I'm not certain I could learn a radically different software package for that purpose.

I understand. To me, adding to my toolbox another software similar to one with which I'm already familiar but which has features expressly designed for the task at hand, is less work than learning a scripting language.

I'm glad that Illustrator and InDesign have their own Javascript implementations. But most of the times I use it in Illustrator, I end up asking myself why I'm kicking against the thorns? Why am I going to all this tedium in an attempt to add in a half-baked fashion a "feature" that is already standard-fare and better integrated in other programs? (I really do it for the learning exercise.) I mean, aren't WYSIWYG programs supposed to prevent us from having to continually re-invent the wheel in code?

So, yeah, at least the scripting option is there, and that's a good thing. But as you can see from the first script, getting the area of a pathItem is a simple one-statement call to a pre-defined property of a pathItem object: area. So why isn't access to that property provided in some appropriate place in the program's standard interface?

I'd much rather be using AI's Javascript to build new features like instant spherical grids or branching paths for trees and lightning. But I find that most of my scripting experiments end up mimicing features that really ought to be in the standard program anyway. (Joining paths, reversing paths, working with tab-delimited text, etc.)

Anyway, I'm glad the script helped. Maybe others will get use from it, too, and at least thereby avoing having to re-invent the wheel again. ;-)

JET

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 ,
Sep 04, 2007 Sep 04, 2007

Copy link to clipboard

Copied

JET:<br /><br />Thanks for your response! Hmmm, we seem to be drifting away from the original topic. If you want to continue off-line... let me know.<br /><br />Each of us builds our toolbox differently -- hopefully we know ourselves well enough after a while to know what works best. I generally prefer to be more adept at few distinct software packages, as opposed to trying to remember the details --and the general paradigm-- of more packages. (For the life of me, I can't retain how to use ImageReady, for example -- I just don't use it often enough.) That said, I'm OK with learning just the features I need to do my work, which places me in danger of missing out on potentially very useful tools. With unavoidable software from one vendor I find it is best to stick to the lowest-common-denominator functions and to avoid customization -- maybe a superstitious way of improving stability of the product.<br /><br />I have a history of working with code going back to the early 1970's so I'm quite OK with scripting, except that, well, the nature of coding has changed. To quote the songwriter, "the thrill is gone." There are too many (scripting) languages to learn, they are often complex, and typically there's a huge array of library functions (or equivalent) in each. A daunting task, each one of them.<br /><br />As for including functions like area in the standard interface, I think you mean the GUI, and I have mixed feeling about that, especially as features accumulate, and the GUI gets more and more difficult to navigate. If I did not have this particular problem, I'd probably be frustrated by seeing "length" and "area" functions in the GUI -- just some extra stuff that I don't need -- or some functions that I really might want to learn, but don't have the time.<br /><br />Hmmm, you would like to build really innovative features in AI's JS, and I hope you do that. (Sorry, my task wasn't really very interesting <grin>.) <br /><br />Thanks,<br /><br />Henry

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
LEGEND ,
Sep 04, 2007 Sep 04, 2007

Copy link to clipboard

Copied

> If you want to continue off-line...

What, and have everyone else miss out on this stimulating intellectual discourse? Not a chance.

;-)

JET

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
Explorer ,
Sep 04, 2007 Sep 04, 2007

Copy link to clipboard

Copied

>>Not a chance.

I second that. There are always lurkers who enjoy the information.

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 ,
Oct 02, 2008 Oct 02, 2008

Copy link to clipboard

Copied

Is there a way to calculate the area of selective components in a photo?
For example, I have photos of plant leaves in a chamber, and I'd like to be able to calculate the 2D (top down view) surface area of the leaves?

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
LEGEND ,
Oct 02, 2008 Oct 02, 2008

Copy link to clipboard

Copied

1. Make sure the background of the photo (the bottom of the chamber) is of high contrast to the plant leaves.

2. Either posterize the image in Photoshop, or with auto-trace settings in Illustrator. (see LiveTrace in the help documentation.)

3. Auto-trace the photo. Use the script referenced above to get the area of the resulting path(s).

JET

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 ,
Dec 31, 2008 Dec 31, 2008

Copy link to clipboard

Copied

Just recently had to come up with a solution for a similar problem and stumbled upon this thread. Excellent info here, Thanks!

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 ,
Jan 07, 2009 Jan 07, 2009

Copy link to clipboard

Copied

I just had a need to measure the area of AI cut-out letter templates for signage and the Cmd-Shift-Option-F12 solution worked a treat in CS4 as well!
Many thanks to all the contributors.

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 Beginner ,
Aug 26, 2010 Aug 26, 2010

Copy link to clipboard

Copied

I found this whole thread very interesting. I remember stumbling across it first time it appeared and was very happy to rediscover it as it contained Teri's trick window which I'd forgotten about

It inspired me to add a forth method to the equation, which just got publishing on our Astute Graphics blog: www.astutegraphics.com/blog/calculating-an-objects-area-in-illustrator/

I thought that it may be of interest as it provides a method to calculate the area of all object types - including images, even if the result is more approximate compared to the precise results offered by the afore-mentioned script, plugin and debugging window. But I concede that the method isn't free to those who haven't already bought Phantasm CS Publisher, which the other methods are.

I wanted to thank all those who contributed to this thread, especially James (JET) and Toby (Telegraphics) for producing tools I genuinely use myself!

Nick

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
LEGEND ,
Aug 28, 2010 Aug 28, 2010

Copy link to clipboard

Copied

Nicholas,

It is inappropriate to post links on your website to someone else's website without asking permission.

JET

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 Beginner ,
Aug 28, 2010 Aug 28, 2010

Copy link to clipboard

Copied

JET,

All links removed as requested.

Nick

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
LEGEND ,
Aug 28, 2010 Aug 28, 2010

Copy link to clipboard

Copied

Thank you. I trust you will now remove the completely unnecessary reference to my script and the "removed at author's request" note.

This comment on your site, by the way, is erroneous:

Each method...all have the same disadvantage; they can only provide a result for simple paths – not compound paths...

Illustrator's Javascript model does not provide an area property for a CompoundPathItem. That doesn't mean you can't get the area of a CompoundPathItem via AI's Javascript. Just because I didn't bother to do so when I keyed my script--which was written for my own purposes and mentioned only in casual threads in this forum by me, and not intended for anyone else to appropriate to buttress the virtues of their plug-in--doesn't mean it can't be done.

The AI Javascript model does provide access to a CompoundPathItem's subpaths via its pathItems property. Computing the area of a CompoundPathItem via Javascript is therefore fairly trivial, by using the area and polarity properties of the pathItem object. All one has to do is loop through the pathItems of the CompoundPathItem and either add or subtract their areas, based on whether the polarity property is PolarityValues.NEGATIVE or PolarityValues.POSITIVE.

Finding areas of other object types would be similarly trivial. The area of a raster image could simply be based on its bounds. Getting the area of a clipping path is a simple matter of directSelecting the path before running the script.

So you might also reconsider that particular marketing argument for your plug-in.

JET

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 Beginner ,
Aug 29, 2010 Aug 29, 2010

Copy link to clipboard

Copied

JET - please re-read my blog post. You will now find no mention of "JET..." (we have to say there were 3 methods in this original forum pot... because there are). You will also perhaps see that I clearly state the the methods here are free and praise them. I really don't see anybody buying a £139 plugin just for this solution. But it made me curious to see if there was another method with our tool. Call it marketing if you like, but I felt I was clear, honest and generous in my praise of what you have achieved with your scripts.

I am sure that much more is possible with scripts.

I trust this is now the conclusion of this thread of the debate. I had no intention of upsetting you. Life's too short.

Now back to enjoying Sunday.

Nick

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 ,
Aug 29, 2010 Aug 29, 2010

Copy link to clipboard

Copied

Nick,

Just a few Sunday comments:

It is worth mentioning that the debugging window does not show the required information up to 10, so this method is only usable from CS (hopefully) on; this might be mentioned in Important notes.

You have a few misspellings in the blog, the most important one being Terri which should be Teri; a rather common one, regularly seen in this forum.

With regard to your mentioning non Phantasm solutions, as I see it, your explicitly non mentioning the solution by James is rather explicit and thereby conspicuous; besides, the contents is not quite updated, and your mentioning their inability to deal with compound paths still includes all three methods, in other words also the one by James.

I would suggest your changing the introduction as follows (shown as two sets with removal of the BoldItalics in the first one and insertion of the BoldItalics in the second, because seemingly colours and strikethrough do not work here in the forum):

Following a long-running thread on the Adobe Illustrator forum [click here to read],  it emerged that there were three (We have agreed to not discuss the  third.) methods to measure the area of a  vector path within Illustrator.  It was interesting to see that each approach was different – and  free – and included a plugin and a hidden window within Illustrator  intended for debugging by the development team. Each  method has it own  advantages, but all have the same disadvantage; they can only provide a  result for simple paths – not compound paths, clipped paths, etc.

In this tip, we’ll have a look at all the previously-disclosed methods plus a forth  option making unique use of Phantasm CS Publisher’s advanced Ink Coverage tool which caters for all object types, including compound paths, editable text, groups and even images!

Following a long-running thread on the Adobe Illustrator forum [click here to read],  it emerged that there are different  methods to measure the area of a  vector path within Illustrator.  It  was interesting to see that each approach was different – and  free –  and included a plugin and a hidden window within Illustrator  intended  for debugging by the development team. Each of the two methods has it own  advantages, but both have the same disadvantage; they can only provide a  result for simple paths – not compound paths, clipped paths, etc.

In this tip, we’ll have a look at both the previously-disclosed methods plus a third option making unique use of Phantasm CS Publisher’s advanced Ink Coverage tool which caters for all object types, including compound paths, editable text, groups and even images!

Non mentioning is rarely served by mentioning, as may be seen from the Robe tale.

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
LEGEND ,
Aug 29, 2010 Aug 29, 2010

Copy link to clipboard

Copied

we have to say there were 3 methods in this original forum pot... because there are

Excuse me? You "have to"? Why do you "have to" mention a specific informal thread in an open user-to-user forum at all on your commercial site?

You will also perhaps see that I clearly state the the methods here are free and praise them.

And what makes you assume I desire any notoriety from mention on your commercial site? Just because you couch it as [gratuitous and patronizing] praise?

I agree completely with Jacob's assessment that "non mentioning" constitutes mentioning. As far as his suggested edits, though, I would go much further:

Several methods exist for determining the area of a vector path in Illlustrator: Third-party plug-ins designed specifically for the purpose exist. Illustrator's built-in scripting support provides access to the area property of pathItems. There's even a little-known "easter egg" built into the program itself which can be invoked by [the keyboard shortcuts]. Did you know that Phantasm CS Publisher can also be used to find the area of a selection? Here's how: [Description of YOUR method only].

But, of course, that straightforward and appropriate treatment is much shorter. It doesn't fill up your "blog" with others' content as if it's some kind of know-all-end-all resouce about finding the area of a path. It doesn't explicity compare your product's methods with an entirely non-commercial, off-the-cuff approach offered by an individual in an informal user-to-user forum, who may not want your self-serving "praise," no matter how "flattering" you try to make it.

I frequently get requests from individuals, commercial sites, and authors to link to or make mention of my scripts web content. I've always turned them down. My reasons are my own; they are valid, and I don't have to explain or justify them to anyone. The point is, it is customary to ask before you appropriate someone else's web content in a thinly-veiled attempt to add value to yours.

JET

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
Guest
Jun 13, 2012 Jun 13, 2012

Copy link to clipboard

Copied

Jet - regarding the polarity - i downloaded the telegraph plugin - it works fine - but when the path contains a hole in it, the calculation takes into acount the whole plus the hole - do you think this the polarity issue?

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
LEGEND ,
Jun 13, 2012 Jun 13, 2012

Copy link to clipboard

Copied

Asaf,

I don't know anything about the Telegraphics plug-in.

JET

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 ,
Jun 13, 2012 Jun 13, 2012

Copy link to clipboard

Copied

Asaf,

Patharea adds the areas within the selected paths.

To get the area round the hole, you may Direct Select the outer path and apply the Patharea Filter (which will give you the total area within the outer path), do the same for the inner path (which will give you the total area within the inner path, in other words the hole), and subtract the latter from the former.

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
Guest
Jun 13, 2012 Jun 13, 2012

Copy link to clipboard

Copied

Thanks, but I'm looking for an easy way to calculate the ink coverage (we are using ilustrator to design flexo printing, and the files are built with many different paths), so perhaps i will contact telegraphics or, instead, try to enhance the script that Jet introduced (to my opinion - the polarity property is the key).

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 ,
Jun 14, 2012 Jun 14, 2012

Copy link to clipboard

Copied

In this case you could take a look at:

http://www.excourse.com/presspercent/index.html (Mac only AFAIK)

or Phantasm CS (it has an Ink Coverage Preview)

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 Beginner ,
Feb 12, 2013 Feb 12, 2013

Copy link to clipboard

Copied

I'd just like to remind everyone that Photoshop has a built-in measuring tool  for area, perimeter, etc. and can save the results to a file which can be imported in Excel.

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