Figma Support Forum

SVG import/paste with unit width height

I’m testing copy/paste SVG between Figma and Cuttle.xyz (a new CAD app for laser and CNC cutters).

Cuttle copies SVG string with units in width/height, like this:

<svg width="5in" height="5in" viewBox="0 0 360 360" xmlns="http://www.w3.org/2000/svg" version="1.1">

I expect this to paste as 360x360 pixels (72 pixels per inch * 5 inches) in Figma, but instead it pastes as 5x5 pixels:

Same situation with export/import as copy/paste. The test SVG is here: svg copied from cuttle · GitHub

Just to show something fun, here’s a generative Phyllotaxis composition made in Cuttle, pasted into Figma:

The JS code in Cuttle that makes it:

const PHI = 137.5;

const items = [];
for (let i = 0; i < repetitions; i++) {
  const angle = PHI * i;
  const item = input.clone().transform({
    position: Vec(c * sqrt(i), 0).rotate(angle),
    rotation: angle
  });
  items.push(item);
}
return items;
1 Like

Hi,
welcome to the community!

I think Figma doesn’t interpretate values other than numbers inside width/height attributes, so it automatically thinks that the numbers are values in pixels by default.

Even if you try to put cm, mm inside the height/width attributes, Figma still doesn’t convert the values in pixels as it should (Photoshop does it, for example).

That’s what I presume it’s happening.

PS. Cool thing that Phyllotaxis :hushed:

1 Like