2

For example, if I have one object that is 100x75 and another that is 500x900 and I want them to both be 50 wide while retaining their ratios. The goal is to unify all objects of different sizes to one width OR height. In practice I might do this with, say, 20 sponsor logos which all have slightly different sizes.

So far I've found TRANSFORM EACH, but that only seems to scale by percentage and not to a specific dimension, and also All The Things script, which seems to require the objects all be the same ratio to begin with because you have to specific both the desired width AND height.

1
  • This is a trivial task in InDesign where frames can contain any object and automatically scale the content to fit or cover the frame. Commented Apr 16, 2024 at 19:21

2 Answers 2

0

The following script will scale each object based on the maxed width and height entered in the desired unit of measurement. You must have objects selected before running the script.

// Check if there are selected objects if (app.activeDocument.selection.length > 0) { // Prompt user for the unit of measurement var unit = prompt('Enter the unit of measurement (px, in, cm, mm, m):', 'px'); // Prompt user for maximum width and height var maxWidth = prompt('Enter the maximum width (' + unit + '):', ''); var maxHeight = prompt('Enter the maximum height (' + unit + '):', ''); // Convert input to numbers maxWidth = parseFloat(maxWidth); maxHeight = parseFloat(maxHeight); // Convert units to pixels for internal processing switch (unit) { case 'in': maxWidth *= 72; // 1 inch = 72 pixels maxHeight *= 72; break; case 'cm': maxWidth *= 28.35; // 1 cm = 28.35 pixels maxHeight *= 28.35; break; case 'mm': maxWidth *= 2.835; // 1 mm = 2.835 pixels maxHeight *= 2.835; break; case 'm': maxWidth *= 2835; // 1 m = 2835 pixels maxHeight *= 2835; break; case 'px': default: // No conversion needed break; } // Loop through each selected object for (var i = 0; i < app.activeDocument.selection.length; i++) { var selectedItem = app.activeDocument.selection[i]; // Get the current width and height var currentWidth = selectedItem.width; var currentHeight = selectedItem.height; // Calculate the scale ratio var widthRatio = maxWidth / currentWidth; var heightRatio = maxHeight / currentHeight; var scaleRatio = Math.min(widthRatio, heightRatio); // Scale the object selectedItem.resize(scaleRatio * 100, scaleRatio * 100, true, true, true, true, scaleRatio); // Scale the strokes selectedItem.strokeWidth *= scaleRatio; } } else { alert('Please select one or more objects.'); } 
0

Without any scripts

Make sure the logo is grouped, then select it with the Selection Tool (V). You can enter the width numerically in the controls along the top, making sure you have the Constrain Width and Height Proportions option selected.

enter image description here

For semi automation, you could record the above transform as an Action and just select a logo and play it back. You could even assign the action to a Function key, so that it runs when you press that key.

Here's an example Action set up for Shift+F7

enter image description here

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.