Last active
March 14, 2021 08:18
-
-
Save kemiljk/f48fc6b5cf549e5103eaa1abd34eb5df to your computer and use it in GitHub Desktop.
A way to crop all images to the same aspect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: this uses the Scripter API so won't work via regular Figma plugin code | |
// Download here: https://www.figma.com/community/plugin/757836922707087381/Scripter | |
const layers = figma.currentPage.findAll(isImage); | |
figma.currentPage.selection = layers | |
for (let shape of await find(selection(), n => isImage(n) && n)) { | |
// Update image paints to use "FILL" scale mode | |
shape.fills = shape.fills.map(p => | |
isImage(p) ? {...p, scaleMode: "FILL",} : p) | |
shape.resize(375, 375) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment