I have quite a few irregular paths (approx. 200), each with a different bounding box. I want scale all of these to a similar size while maintaining their aspect ratio.





Is it possible?

  • How would it work? Two images with different aspects can not be easily normalized, so would you: Normalize by height, ignoring aspect ratio? By width? Length of circumference? By bounding circle? By height and width (ignoring aspect ratio)? By BB area? Shape area? – joojaa Jan 29 '17 at 11:42
  • I keep ratio and resize by height – Łukasz Mleczko Jan 29 '17 at 12:38
  • And I set that I want to all path have 100point height but width keep aspect ratio. Also I can set ll of path to position x:0 y: 0 – Łukasz Mleczko Jan 29 '17 at 12:47
  • 1
    ok that's just not my idea of normalization. But fine. – joojaa Jan 29 '17 at 13:27

Select objects you want to fit by height and run:

#target illustrator

// ScaleToFitVerticalAxis.jsx
// Copyright (c) 2017 Janne Ojala
// Licence: https://opensource.org/licenses/MIT

visitObjects(app.activeDocument.selection, scaleByHeight, 100)

function scaleByHeight(item, targetHeight){
    var factor = targetHeight / item.height;
    item.height *= factor;
    item.width  *= factor;

function visitObjects(sel, func, opts) {
    for(var i = 0; i < sel.length; i++){
        func(sel[i], opts);


scaled to fit by height

Image 1: Objects on first row are scaled to fit by height on second row.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.