Jump to content
You must now use your email address to sign in [click for more info] ×

2.4.1 - Exported SVGs have different size when reimported?


Recommended Posts

Difficult to explain, I will try (the topic here also https://forum.kicad.info/t/symbol-editor-re-imported-svgs-are-always-to-me-smaller-than-what-they-should-be/49713/3)

 

It occurs with Affinity Designer and not with Inkscape.

I'm creating SVG files that are the graphical construction for components that I'm making in KiCAD.

KiCAD: export basic component in SVG
Affinity: Import the KiCAD SVG and adding graphical features (NOT changing any size)
Affinity: I export in SVG the final draw
KiCAD: i import the new SVG and the whole size is smaller. i have to magnify it by 1.333. not matter if the SVG is 96DPI or 300 or more.

By doing the SAME operations with Inkscape, when I import the SVG in KiCAD: sizes are kept. thus it's 1:1

What's occurring with Affinity Designer export, please?

Edited by Tormy
Added Affinity Designer Version

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

I'm having the same problem -- I'm trying to export designs in SVG in order to be used by a laser cutter, and the sizes get mangled.  I searched online for solutions to this and found many years of complaints and suggestions.  Some of the solutions involve manually editing the SVG files in a text editor!  I tried all the solutions I could find other than those, but none worked correctly in all cases.

Personally, this seems strange.  I would expect that keeping images the same size when exported would be the default!

Link to comment
Share on other sites

Hi @Sam Weber and welcome to the forums,

Affinity apps effectively export SVG files using 72 dpi... Other software including laser cutter software uses 96 dpi as their default which is why often you see a difference in size when importing SVG files.

Depending on the laser cutter software you're using, there may (or may not) be an option in the software preferences to automatically adjust the dpi of the SVG on import...

If you can let us know which laser cutter software you're using as we may be able to provide some additional options for you...

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

3 hours ago, Hangman said:

Hi @Sam Weber and welcome to the forums,

Affinity apps effectively export SVG files using 72 dpi... Other software including laser cutter software uses 96 dpi as their default which is why often you see a difference in size when importing SVG files.

Depending on the laser cutter software you're using, there may (or may not) be an option in the software preferences to automatically adjust the dpi of the SVG on import...

If you can let us know which laser cutter software you're using as we may be able to provide some additional options for you...

as I said: it doesn't matter if you export at 340 DPI or 72 ... the imported size is always the same. Affinity I think has something missing. but I have not clue: what.

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

The laser used by my makerspace is a United Laser Systems model.  The way it is set up is that you have to load your file into Adobe Illustrator on their computer and then "print" it from there.  In other words, I have to produce an SVG file that will have the same size when imported into Adobe Illustrator.

Thanks!

Link to comment
Share on other sites

Hi @Tormy,

12 hours ago, Tormy said:

as I said: it doesn't matter if you export at 340 DPI or 72 ... the imported size is always the same. Affinity I think has something missing. but I have not clue: what.

As mentioned above, Affinity apps (and even Adobe apps) export SVG files using 72 dpi despite the SVG working group defining the DPI of SVG as 96 DPI.

Standard SVGs use actual units, like mm, inches, etc. If software writes an SVG with no units or just pixels (like Affinity apps), then the actual interpretation of those units is not defined...

Inkscape, most Laser cutting and CAD software use 96 dpi. This is why when you reimport your SVG back into KiCAD you end up having to rescale it, i.e., 96 / 72 = 1.333333

I know with some CAD software and Laser-cutting software like LightBurn there’s a setting in Edit > Settings on the File Settings page which allows you to switch between 72 and 96 dpi for SVG import.

I'm not familiar with KiCAD but I believe if importing into the PCB Editor you can set the import scale...

KiCAD.png.74d6bc86b2a3ed1fdc4d41dfeee1eb19.png

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

Hi @Sam Weber,

12 hours ago, Sam Weber said:

The laser used by my makerspace is a United Laser Systems model.  The way it is set up is that you have to load your file into Adobe Illustrator on their computer and then "print" it from there.  In other words, I have to produce an SVG file that will have the same size when imported into Adobe Illustrator.

Both Affinity apps and Illustrator (AFAIK) export SVG files using 72 dpi. The possible difference with Illustrator files is that they likely include units, unlike Affinity apps which may explain why they can be imported at the correct scale.

Are there any options to scale the SVG file when importing it into the MarkerSpace software?

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

7 hours ago, Hangman said:

Hi @Tormy,

As mentioned above, Affinity apps (and even Adobe apps) export SVG files using 72 dpi despite the SVG working group defining the DPI of SVG as 96 DPI.

Standard SVGs use actual units, like mm, inches, etc. If software writes an SVG with no units or just pixels (like Affinity apps), then the actual interpretation of those units is not defined...

Inkscape, most Laser cutting and CAD software use 96 dpi. This is why when you reimport your SVG back into KiCAD you end up having to rescale it, i.e., 96 / 72 = 1.333333

I know with some CAD software and Laser-cutting software like LightBurn there’s a setting in Edit > Settings on the File Settings page which allows you to switch between 72 and 96 dpi for SVG import.

I'm not familiar with KiCAD but I believe if importing into the PCB Editor you can set the import scale...

KiCAD.png.74d6bc86b2a3ed1fdc4d41dfeee1eb19.png

This is what I did yesterday and when I imported the files at 96, size were NOT respected. i'm becoming mad with this because I can't get a solution.

With Inkscape is working fine and I have not clue why ...

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

Hi @Tormy,

I've just had a play with the PCB Editor...

  • If your Affinity Designer Document is set at 96 dpi then objects exported to SVG come in at the correct size
  • If your Affinity Designer document is set at 72 dpi then objects exported to SVG come in at (72 / 96) x 100 = 75%
  • If your Affinity Designer document is set at 300 dpi then objects exported to SVG come in at ((300 - 96) / 96) x 100 = 212.5%
  • Regardless of the Affinity document dpi exporting to DXF will import the file in at the correct size

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

The issue is with SYMBOL EDITOR.

Ah yes now there is teh DXF. I will experiment it as well. Right

 

EDIT: by importing in KiCAD a DXF made in Affinity

 

image.png.3d42670922493a04b8e7634e3401c275.png

 

this was the original non-sense-just-to-test draw

 

image.thumb.png.c143a23de06c34f81130668abe9bb7aa.png

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

32 minutes ago, Tormy said:

The issue is with SYMBOL EDITOR.

KiCAD is not software I'm familiar with but I just added a 50 mm x 50 mm SVG file exported from a 96 dpi Designer file to the Symbol editor then exported it back out to an SVG file, reopened it in Designer and it maintained its 50mm x 50 mm size but I could equally be missing the issue...

The basic problem I see is that every time you export an SVG file from KiCAD and open it in Designer you will need to change the Document Setup DPI from 72 to 96 dpi before re-exporting back to an SVG file for use in KiCAD.

Out of interest, what do you see size wise with the attached SVG and DXF Files in the Symbol Editor?

96 dpi Files Exported from Designer

Square 50 x 50 mm 96 dpi.svg

Square 50 x 50 mm 96 dpi.dxf

 

72 dpi Files Exported from Designer

Square 50 x 50 mm 72 dpi.svg

Square 50 x 50 mm 72 dpi.dxf

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

1 hour ago, Hangman said:

KiCAD is not software I'm familiar with but I just added a 50 mm x 50 mm SVG file exported from a 96 dpi Designer file to the Symbol editor then exported it back out to an SVG file, reopened it in Designer and it maintained its 50mm x 50 mm size but I could equally be missing the issue...

The basic problem I see is that every time you export an SVG file from KiCAD and open it in Designer you will need to change the Document Setup DPI from 72 to 96 dpi before re-exporting back to an SVG file for use in KiCAD.

Out of interest, what do you see size wise with the attached SVG and DXF Files in the Symbol Editor?

96 dpi Files Exported from Designer

Square 50 x 50 mm 96 dpi.svg 685 B · 0 downloads

Square 50 x 50 mm 96 dpi.dxf 72.45 kB · 0 downloads

 

72 dpi Files Exported from Designer

Square 50 x 50 mm 72 dpi.svg 686 B · 0 downloads

Square 50 x 50 mm 72 dpi.dxf 72.46 kB · 0 downloads

With your files, The only one I got smaller is the 72 dpi SVG.

 

Try multilayers in DXF please and see if you get the errors I got and shown on my previous intervention

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

Hi @Tormy,

19 hours ago, Tormy said:

With your files, The only one I got smaller is the 72 dpi SVG.

So the 96 dpi SVG file is now coming into the Symbol Editor at the correct size, is that correct? If so then the solution is to ensure your Affinity Designer document is set to 96 dpi when initially exporting and you'll need to change it to 96 dpi when opening any SVG files exported from KiCAD prior to making changes and re-exporting...

20 hours ago, Tormy said:

Try multilayers in DXF please and see if you get the errors I got and shown on my previous intervention

The error message you're getting when importing the multilayer DXF is caused by the fills on the two shapes/curves. Change those to strokes only and you won't get the error.

I don't know KiCAD well enough to understand why certain shapes are interpreted the way they are when importing as a DXF, e.g., the horizontal lines for the red curve or the lines that make up the cog appear to be missing but importing as a 96 dpi SVG seems to import everything correctly...

DXF Import Left | SVG Import Right

Shapes.thumb.png.242e3b4aa22b5c717bf42cf43185dd9c.png

 

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

An update -- exporting at 72 dpi, exporting text as curves and using hex colors ended up working for me.  There was one file that appeared not to work, but I eventually realized that the bounding box used by the SVG wasn't the same as the one used by Affinity Designer and once I accounted for that things worked.

 

However, given that this issue seems to come up repeatedly, perhaps I can request a feature update that an option to include size when exporting to SVG be added?  Thanks!

Link to comment
Share on other sites

13 hours ago, Hangman said:

Hi @Tormy,

So the 96 dpi SVG file is now coming into the Symbol Editor at the correct size, is that correct? If so then the solution is to ensure your Affinity Designer document is set to 96 dpi when initially exporting and you'll need to change it to 96 dpi when opening any SVG files exported from KiCAD prior to making changes and re-exporting...

The error message you're getting when importing the multilayer DXF is caused by the fills on the two shapes/curves. Change those to strokes only and you won't get the error.

I don't know KiCAD well enough to understand why certain shapes are interpreted the way they are when importing as a DXF, e.g., the horizontal lines for the red curve or the lines that make up the cog appear to be missing but importing as a 96 dpi SVG seems to import everything correctly...

DXF Import Left | SVG Import Right

Shapes.thumb.png.242e3b4aa22b5c717bf42cf43185dd9c.png

 

Thank yo a zillion for the hints.

however I tired with this SVG in attachment and I got the same errors. And I just have the Strokes only

TWO_SHAPES.dxf

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

14 hours ago, Hangman said:

Hi @Tormy,

So the 96 dpi SVG file is now coming into the Symbol Editor at the correct size, is that correct? If so then the solution is to ensure your Affinity Designer document is set to 96 dpi when initially exporting and you'll need to change it to 96 dpi when opening any SVG files exported from KiCAD prior to making changes and re-exporting...

The error message you're getting when importing the multilayer DXF is caused by the fills on the two shapes/curves. Change those to strokes only and you won't get the error.

I don't know KiCAD well enough to understand why certain shapes are interpreted the way they are when importing as a DXF, e.g., the horizontal lines for the red curve or the lines that make up the cog appear to be missing but importing as a 96 dpi SVG seems to import everything correctly...

DXF Import Left | SVG Import Right

Shapes.thumb.png.242e3b4aa22b5c717bf42cf43185dd9c.png

 

Please this is the 96DPI SVG created into Designer and imported in KiCAD ... it should be 10 cm .. it is 31.5 cm instead.
I attach also the project.
I got identical issues in DXF

In attachment the SVG and the DXFs as well.


 

PROBLEM1.dxfImported_96DPISVG.png

PROBLEM.afdesign 100mm.svg

PROBLEM2.dxf

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

Hi @Tormy,

8 hours ago, Tormy said:

Please this is the 96DPI SVG created into Designer and imported in KiCAD ... it should be 10 cm .. it is 31.5 cm instead.

This is because your Affinity Designer document is still set at 300 dpi, so as a result your line is ((300 - 96) / 96) x 100 = 212.50%, 10 cm + 212.50% = 31.25 cm

You need to set the Affinity Designer Document Setup to 96 dpi... then your SVG and DXF files will exported at the correct size...

DocumentSetup.png.d5242debd0299f9485e79f683cfdefac.png

Your Two Shapes file still uses Fills rather than Strokes which is why you see the error, try the attached version. I've changed the Document Setup to 96 dpi then changed the two objects to use Strokes with no Fill and then exported to SVG and DXF.

 

Two Shapes.afdesign

Two Shapes.dxf

Two Shapes.svg

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

7 hours ago, Hangman said:

Hi @Tormy,

This is because your Affinity Designer document is still set at 300 dpi, so as a result your line is ((300 - 96) / 96) x 100 = 212.50%, 10 cm + 212.50% = 31.25 cm

You need to set the Affinity Designer Document Setup to 96 dpi... then your SVG and DXF files will exported at the correct size...

DocumentSetup.png.d5242debd0299f9485e79f683cfdefac.png

Your Two Shapes file still uses Fills rather than Strokes which is why you see the error, try the attached version. I've changed the Document Setup to 96 dpi then changed the two objects to use Strokes with no Fill and then exported to SVG and DXF.

 

Two Shapes.afdesign

Two Shapes.dxf 72.72 kB · 0 downloads

Two Shapes.svg 942 B · 0 downloads

yes it worked.

 

although when I exported I setup the export in this way here below. So not clue why it had exported 300 ... indeed as you can see, I named the fiels 96DPI just by reading it form that window ... however fixing it inside the doc is working

image.png.5026f05a46fd99a13137c328e8512ef3.png

System:

Prod. Machine: Ryzen 7 64GB 3.54 GHz
Video: MSI GeForce 4060Ti 16GB
Monitors: 1 x 3840x1440 widescreen, 2 x 1920 x 1080 16:9
 

YT Channels
https://youtube.com/@Not-Only-Reaper-Tutorials
https://youtube.com/@RicordiDellaRAI

 

Link to comment
Share on other sites

1 minute ago, Tormy said:

although when I exported I setup the export in this way here below. So not clue why it had exported 300 ... indeed as you can see, I named the fiels 96DPI just by reading it form that window ... however fixing it inside the doc is working

I have to say that I'm equally unsure why the dpi in the export settings doesn't work, I was planning to do some testing around it before reporting it as a potential bug but in the meantime, I'm glad you now have a workable solution to the issue by setting the Document itself to 96 dpi...

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

17 hours ago, Tormy said:

When I exported I setup the export in this way so not clue why it had exported 300... indeed as you can see, I named the field 96 DPI just by reading it form that window ...

The issue is simply that Affinity apps don't use user units but instead use pixels so this is what you end up with:

Document 72 dpi | Exported at any dpi value

<g transform="matrix(1,0,0,1,-69.9648,-64.2955)">
    <rect x="70.866" y="65.197" width="141.732" height="141.732" style="fill:none;stroke:black;stroke-width:1px;"/>
</g>

Document 96 dpi | Exported at any dpi value

<g transform="matrix(1,0,0,1,-93.2863,-85.7273)">
    <rect x="94.488" y="86.929" width="188.976" height="188.976" style="fill:none;stroke:black;stroke-width:1.33px;"/>
</g>

Document 300 dpi | Exported at any dpi value

<g transform="matrix(1,0,0,1,-291.52,-291.52)">
    <rect x="295.276" y="295.276" width="590.551" height="590.551" style="fill:none;stroke:black;stroke-width:4.17px;"/>
</g>

So when importing into KiCAD and pretty much any other non-pixel-based application that correctly assumes 96 dpi, the imported objects are scaled accordingly...

You can easily edit the SVG file in a text editor to change the width, height and stroke values to this for a 50 mm x 50 mm Square

<g transform="matrix(1,0,0,1,-291.52,-291.52)">
    <rect x="295.276" y="295.276" width="50mm" height="50mm" style="fill:none;stroke:black;stroke-width:1pt;"/>
</g>

But this doesn't answer the question as to why setting the dpi value in the export window doesn't change the value correctly...

Affinity Designer 2.5.5 | Affinity Photo 2.5.5 | Affinity Publisher 2.5.5
MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse
HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.