Skip to main content

Batch resize longest sides of selected elements (resize to fit)

  • January 31, 2022
  • 2 replies
  • 1487 views

AnneK

How can I batch resize the longest sides of the elements I have selected? In other words, how can I batch resize to fit into a frame with a specific size?

I have a lot of vectors. They are all in different sizes, and I want to resize them to fit into a 20x20px frame. It is easy to batch resize all the vectors so that they all have a 20px width or a 20px height. But I want them to be 20px on their longest side, which for some vectors is the width and for others the height.

I haven’t been able to find any Figma functions or plugins that allow me to do this. My current solution is this:

  1. Select parent frames
  2. Plugins > Automater > Object > Add Autolayout to each
  3. Set AL alignment to center
  4. Set height & width to fixed, 20px
  5. Select vectors (Enter)
  6. Plugins > Automater > Resize > Scale to fit to parent
  7. Select parent frames (Shift+Enter)
  8. Set height & width to 24px
  9. Plugins > Remove Autolayout Faster

I use Autolayout because I want the vectors to be centered inside the 20x20px frame (AFAIK there is no way to batch Align the vectors inside their parent frames), which does not happen automatically when using the Automater plugin’s Resize to Fit option. I have to remove Autolayout again in the last step because otherwise the vectors will not scale along with the frame when I resize the frame later. Unfortunately, removing Autolayout with Remove Autolayout Faster takes a very long time for the hundreds of frames I have. Disable Autolayout is faster but it doesn’t work on components, and my frames are components.

Does anyone have a better/faster way to do this?

This topic has been closed for comments

2 replies

AnneK
  • Author
  • 14 replies
  • January 31, 2022

It seems like the Icon Resizer plugin might do exactly this!

image


  • 0 replies
  • March 2, 2022

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings