Inkscape vs. Illustrator svg size handling

Hey Team! I’m turning out a copy of @timjedwards great Anclliary Mode Dial, and while doing an edit to the acrylic overlay, I noticed that Illustrator scales the design differently than Inkscape does. If I open it in Illustrator, the piece measures about 4" wide. That’s too big, as I found out after printing! But if I open it in Inkscape, it measures about 3" wide, the correct size. What’s going on?

Thanks Tim for sharing the design!

I have encountered that a few times. It has to do with the dpi (dots per inch) that each software uses. They unfortunately don’t use the same dpi. So designs created in one will show up a different size in another. It’s REALLY frustrating.

My current workaround is to resize them. I don’t know if there’s a way of saving it using a certain dpi so that it opens correctly in the other.

1 Like

I use Inkscape and not Illustrator, but this is usually resolved by unchecking “responsive” when exporting from Illustrator, as that option can resize your image.

1 Like

Can you export as a svg? In my version of inkscape, I only see export to png. I don’t see a way of saving my svg with a different dpi.

Inkscape uses svg as its native format, but in the “save as” dialog you can choose “plain svg” to get rid of some of the extra content Inkscape squirrels away to implement some of its features. Those can confuse some other applications, though the Glowforge seems immune.

DPI stands for Dots Per Inch and only applies to raster files. By definition an svg has no DPI until you convert it to raster (e.g. save as a raster format like png, or print to a laser or inkjet printer), unless it has embedded raster images.

1 Like

I may be completely wrong, but I think that SVGs use pixels as units (not inches, or mm). A square saved in svg is 90 pixels by 90 pixels, not 1 in by 1 in. So if Inkscape thinks there are 90 dpi, then a 90 pixel square will show up as 1 in by 1 in. But if Illustrator thinks there are 72 dpi, the same square will be slightly bigger than 1 in.

That is my understanding of the problem. I’ve yet to come up with a solution to save something in Inkscape in a way that will maintain it’s dimensions in Illustrator.

One of the things I currently do is work on a template that 12" x 20" (GF bed size). So if I open the page in a different application and it’s not 12 x 20, it’s easy to resize the whole thing to 12" x 20".

2 Likes

Yeah the confusion comes from the interpretation of a unit size. Inkscape, Illustrator, your browser, etc can all use different values. Illustrator displays 72 pixels per inch, old Inkscape was 90, Chrome was 96, etc.

Which Inkscape are you using? I’m not very well versed in Inkscape so maybe someone can chime in with better instructions - but I I think you need to go into Document Properties and set that to your preferred unit.

I went into Doc Properties, and I can’t find the dpi anywhere.

I looked online for solutions, but did not find anything easy.

You aren’t looking for the DPI/PPI in there. That’s set by the program itself (don’t think it can be changed, but if it can be, it will be deep in an external config file). You just want to set the document up to use your preferred unit (inches, mm, etc). That will set the resulting SVG file to a specific unit size, rather than pixels (which can be interpreted differently by different programs).

If it says 1 inch for an element in the SVG, whatever other program will see it as 1 inch and render it accordingly to the pixels per inch value the program uses.

I already set my display units and document units to inches.

Hopefully that is enough.

Here is an SVG I made with Inkscape that has a 1"x1" square that is 1" from the bottom and 1" from the left. The document is 12"x20". Right click to save it.
square

If I look at the svg code, I see that the document properties are set in inches:

<svg

width=“20in”
height=“11.999999in”

But I don’t see the dpi anywhere.

And when I look at the rectangle, there are no units, but it’s obviously not inches:

<rect
style=“opacity:1;fill:none;fill-opacity:1;stroke:#0000ff;stroke-width:0.25400001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke”
id=“rect4484”
width=“25.146”
height=“25.146”
x=“25.527002”
y=“246.327” />

So I don’t know how the SVG specified how wide one pixel is.

I don’t have Illustrator, so I can’t tell if it will scale well in Illustrator. If anyone has Illustrator, can they save the svg, open it and tell me how big the square is (and it’s position)?

Thanks.

I don’t think I’m explaining it very well…

The DPI is program dependent. We will use Inkscape and Illustrator as an example.

A couple of scenarios:

If you create a 96 pixel square in Inkscape, it will appear to be 1 inch against the in-program rulers (I believe the newest Inkscape uses 96 dpi, the older version uses 90)

If you save that SVG and it doesn’t define the units, or the units are defined as pixels, then it’s assumed to be a 96 pixel square - not 1 inch.

If you bring that SVG into Illustrator (which uses 72 DPI) - your square will no longer be displayed as being an inch - it will be 1.33” in the program because the DPI representation is different.

Now, if you set the document to an absolute unit like inches.

Create a 1” square. In Inkscape, if you change the unit display to pixels, it will show 96. Change it back to inches, it will be an inch.

Since inches are defined in the file, when you open it in Illustrator (or the GFUI), your square will be 1”. If you change the Illustrator rulers to pixels, it will show 72 pixels.

1 Like

it’s .99" x .99" in illustrator.

Yeah, I understand what’s causing the issue. We are converting from pixels to inches, but how many pixels are in an inch changes depending on the program we are using (90, 96 or 72). Thus if I say my square is 90 pixels, that could be 1", 1.1" or 0.9" depending on the dpi.

I’m just not sure where Inkscape is saving the units. I can see that it’s saving the document size (12 x20in).

It’s also using millimeters for the rectangle, since it’s width and height are set to “25.146” (which is 0.99 mm). But I don’t see where it specifies that the 25.146 is in mm. Perhaps mm is the default unit in svg? I did not use mm anywhere in my design.

I’m glad to see that @shop was able to open it, and it shows up as about 1"x1" in illustrator.

I’m always worried that I’m going to make an SVG in Inkscape, sell it on Etsy, and have someone open it in Illustrator and say: “these dimensions are all wrong, this guy does not know what he’s doing”.

Bottom line is I want to know how to save my svg in Inkscape so that anyone, using any standard program, will get the right dimensions.

http://wiki.inkscape.org/wiki/index.php/Units_In_Inkscape

So the CSS working group decided that 1 inch meant 96 pixels, and that’s what the latest Inkscape assumes.

3 Likes

Is this section of the document setup page relevant? I changed the scaling to 99 px and that resizes everything.

Here is the breakdown of your file (which shows as .9935" in Illustrator for me)

width=“20in” height=“11.999999in”

This specifies inches.

You didn’t include the viewbox line in your above reply, but it’s important. It says:

viewBox=“0 0 508.00001 304.80001”

Those are “user units” that for whatever reason come out to mm.

How it got to that point, I don’t entirely know because I have no idea what’s been changed on your end in your figuring all of this out. :slight_smile:

So we have two “units” in the document: Inches and User Units. Since we know the absolute document size, we can determine the relationship between the two.

After that, you have your design element, a square :

width=“25.146” height=“25.146”

That’s saying that the square should be 25.146 user units square, which when you do the math, comes out to 1".

The link that @timjedwards linked to above, shows more about how Inkscape defines and handles units.

For example, this section:
Consider an SVG with the following SVG root element:

<svg width="10in" height="6in" viewBox="0 0 50 30">
Drawing size
This is a nominal 10x6 inch drawing.
The actual size of the drawing when displayed depends on how it is displayed. It is very unlikely to be the nominal size when displayed on a digital screen.
The width of '10in' could be equivalently written as '25.4cm', '254mm', etc.
The width could also be written as '960' or '960px' using the CSS/SVG defined value of 96 pixels per inch.
If a 'unit identifier' is missing or 'px', the length is interpreted to be in 'user units'. CSS requires the use of a 'unit identifier'. Thus while one can write 'font-size="20"' (an SVG presentation attribute), one must write 'style="font-size:20px" (a CSS style value).
Inkscape 0.91 and earlier used a value of 90 pixels per inch.
Initial 'user unit'
The 'viewBox' defines the drawing to be 50 'user units' wide and 30 'user units' high (with no offset of the origin).
A rectangle with 'width="10"' is 10 'user units' wide which would correspond to 2 inches at the nominal drawing size (if no scaling transforms are applied).
A rectangle with 'width="1in"' is 96 'user-units' wide, corresponding to a width of 19.2 inches at the nominal drawing size. This is not what one would naively expect and is the reason the use of 'unit identifiers' is not recommended inside the SVG document (other than on the root 'width' and 'height'.
The 'user unit' can be scaled by a transform. For example, if a group has a scaling transform of 0.5 ('transform="scale(0.5,0.5)'), the 'user unit' is half the length of the initial 'user unit' and objects inside the group are drawn at half their nominal size.
2 Likes

Thanks for the great explanation!

I never would have guessed the viewBox had something to do with it.

1 Like

Great discussion team! Thanks for all the input.