Anyone know a way to subtract a specific amount from the size of all objects selected?
Copy link to clipboard
Copied
I have a file filled with objects at a specific size which need scaling in a way which reduces 9mm from the top and bottom of each individual object. I thought i could select all objects and type -9 in the transform size tab but this just re sizes everythihng to -9mm. I am not great with maths so perhaps there is an equation to work out the perentage needed so i can scale using the transform scale function but the problem with this is that there is a gap between each object and the scale function takes these gaps into account meaning it is impossible to get it to re size the shapes to the specific sizes (I think). Hopefully I have explained this properly. Does anyone know if what im trying to achieve is possible? If not I will just have to redraw the file from scratch using the altered dimensinos.
Perhaps this can be done with an action or script? Or am I overcomplicating this?
Any help is appreciated!
Thanks,
- Jake
Explore related tutorials & articles
Copy link to clipboard
Copied
The script Set all the things might help.
Copy link to clipboard
Copied
Thanks for this. I just tried it out but unfortunatley won't quite do the job as the script only allows me to set everything to a specific size and will not let me subtract an amount from the current size. I tried putting -9 in the value for width and height but it just said it was an invalid entry and needs to be above the minimum amount. Aprreciate the suggestion though. 🙂
Copy link to clipboard
Copied
Which version of Illustrator are you using?
Can you share a sample .ai file with some instructions?
Copy link to clipboard
Copied
yes please share a sample file if possible.
do you need to resize to -9mm vertically? Horizontal measurement will adjust accordingly
what kind of objects are you dealing with?
Copy link to clipboard
Copied
Jake,
As I (mis)understand it, you can select all and then use Object>Transform>Transform Each, inserting the following value in the Vertical Scale: start with the desired resulting height which is the original height minus 9 and mulitply by 100 (you can just add 00 or move the decimal point two places to the right) then add / and then add the original height.
If you wish proportional scaling just use the same value for Horizontal Scale.
If you wish unchanged width just leave the Horizontal Scale at 100%.
To illustrate: if your objects have a height of 144, you start with 144 - 9 = 135 which you multiply by 100 and get 135 * 100 = 13500 which you insert in the Vertical Scale box, and then you add / and 144, so the full insertion is 13500/144, which will show up as 93.75% in the box when you click the Horizontal Scale box. You can just copy either 13500/144 or 93.75 to the Horizontal Scale box.
All this is based on the fact that Illy (job description Adobe Illustrator) can do one operation with + or - or * or /).
If you want 9 cut off at both top and bottom you will need to subtract 18 (2 * 9 = 18) of course.
Copy link to clipboard
Copied
This should vertically scale down selected objects 9 mm from top and 9 mm from bottom.
for (var i = 0; i < selection.length; i++) {
var percentage = ((selection[i].height - (9*2*2.835)) / selection[i].height) * 100;
selection[i].resize(100, percentage, true, false, false, false, 0, selection[i].scaleAbout = Transformation.CENTER);
}
Copy link to clipboard
Copied
Nice!
Does the selection[i].scaleAbout = Transformation.CENTER mean anything special? I normally use just the constant on it's own as the parameter.
Copy link to clipboard
Copied
No, that's just me not knowing how to use constants as arguments. Thanks.
Copy link to clipboard
Copied
hahaha
Copy link to clipboard
Copied
Very good approach, femkeblanco.
I did some experiments with Pathfinder effects in conjunction with some other effects. They do work, but they are not nearly as versatile as your beautiful script.
Copy link to clipboard
Copied
Just to show that in certain situations one can also do it without using a script, here is the Pathfinder approach for filled (unrotated) paths.
https://drive.google.com/file/d/1GXCmSgXXSgrc26z779LsiaROqqlEM2db/view?usp=sharing
Instructions:
- Select all
- In the Graphic Styles palette apply the style Subtract_10_mm_top_bottom
- Object > Expand Appearance
In this case the style subtracts 10 mm (top) and 10 mm (bottom), but you can easily modify the settings in the Appearance palette. Plus, you can have different subtract settings (sizes) at the bottom and the top of the paths.
As already mentioned, it is not as versatile as the scripting approach, but at least it is really subtracting things, not just resizing 🙂

