Is it possible to set the resolution in a template?

Post questions on how to use or achieve an effect in Inkscape.
Uaneme
Posts: 9
Joined: Tue Oct 24, 2017 7:51 am

Is it possible to set the resolution in a template?

Postby Uaneme » Sat Nov 04, 2017 8:34 am

Is it possible to set the resolution in a template?

Problem: Inkscape's bitmap resolution is sometimes set to a different value, depending on OS / inkscape version / user preferences.

I want to make a template that sets makes sure that whenever that template is used that the bitmap resolution also changes to whatever is needed. 72, 90, 96, 120, 300dpi etc.

I don't see an option in the document template for this. I only find it in inkscape perferences, and to my surprice i can't fix this in a template.
Eventhough there IS a template that pretends to be "CD Cover 300dpi" but that one DOES NOT change the DPI value to 300DPI at all!

May i say WTF?

...well WTF?

Is there a way to do this? I guess yes... And if yes, then how on earth is this done?


A big thanks in advance to the Inkscape wizard who can solve this riddle.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Is it possible to set the resolution in a template?

Postby Moini » Sat Nov 04, 2017 9:37 am

What exactly do you mean by 'bitmap resolution'? The default import resolution? You can resize bitmap images inside Inkscape, so there is no fixed resolution for those.
The default export resolution?
The file's own 'resolution'?

Can you give a more detailed example of what you want to achieve?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Uaneme
Posts: 9
Joined: Tue Oct 24, 2017 7:51 am

Re: Is it possible to set the resolution in a template?

Postby Uaneme » Sun Nov 05, 2017 9:12 am

Inkscape Preferences > Bitmap

There are 3 settings
Export
Create
and Import.

It's just very annoying when people use Inkscape for CNC projects and for some reason the bitmap resolution of inkscape causes scaling issues.
I hope to fix this for once and for all by providing a template that fixes the settings that matter for that use case.

I hope it is possible to fix these settings in he template somehow.

Ideally Inkscape should not use Imperial related stuff at all in a world that's ever more moving to the metric system.
90dpi is no standard 'system' Inch is Millimeter is, but 'something' dots per inch. Thats just silly... In a vector based software i would expect 1 to be set to Metric Imperial mm cm, M, I, F, px, pt. But NOT to whatever DPI... I know Inkscape comes from a screenbased resolution PPI, Pixels Per Inch that can output to printers in DPI Dots per inch

An Inch is an inch A mm is a mm. But a dot is ... variable depending on something that is different on almost every PC...

So now you also know the frustration that is the crux of the whole annoyance. :-)

Fixing the real issue would be ideal, but if it is for now possible to make a template that fixes the DPI Bitmap settings that could reduce the frustration a little bit. But it could cause new frustrations since the real issue still exists.

OR I (and many others) just don't understand Inkscapes logic.

If I set Inkscape to mm and draw a line of 10 mm and export the file then 1 cm is a certain amount of dots. Thats not a real world measurement is it?

Ok, lets leave it at that... I just need a way to make this template. (If possible)

Thanks for your patience. :-)

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Is it possible to set the resolution in a template?

Postby Moini » Sun Nov 05, 2017 11:11 am

There's no difference between the 'meaning' or 'usage' of metric and imperial units when it comes to vector graphics - they both represent real world units, while the vector instructions in the vector graphics are purely digital by nature. You can use a mm template, or just the pixel template, if you want something else. Switching the unit for CNC purposes works a bit different from normal unit switching for a file, *if* the CNC program is blind to document units / viewbox settings.
See FAQ: https://inkscape.org/en/learn/faq/#inks ... rogram-xyz

As a general rule: If a setting is made in the Inkscape preferences, it's saved in preferences.xml, the user configuration file. If a setting is saved in Document Properties, it is saved per document. So - those default import/export/make bitmap copy resolutions are per Inkscape user, not per Inkscape file.

Btw. Inkscape's standard resolution is 96 dpi now. Learn more here: https://inkscape.org/en/learn/faq/#dpi_change
Read more about units in SVG here:
https://www.patreon.com/posts/units-part-i-13563546 (article series over 4 posts by a core Inkscape developer, very informative)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Is it possible to set the resolution in a template?

Postby brynn » Sun Nov 05, 2017 3:04 pm

It's just very annoying when people use Inkscape for CNC projects and for some reason the bitmap resolution of inkscape causes scaling issues.

I'm not sure how bitmap resolution can cause a problem for CNC, because CNC uses the vector paths. Not unless you mean when the raster image is imported.

Maybe you could write instructions in the template file - maybe on a special layer or something - about how to set the Image Import dialog?

Could it be, if your users are using 0.92 and higher, they have the Scale vs Display Units wrong? https://inkscape.org/en/learn/faq/#inks ... rogram-xyz

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to set the resolution in a template?

Postby v1nce » Sun Nov 05, 2017 11:48 pm

NO.

You can't save dpi information in template, so the name "CD Cover 300dpi" is just pure nonsense. I reported a bug.

The only informations in the template are :
the preferred unit is set to "pt" (one of those strange unit that should have died a long time ago) which is around 0.353 mm.
the width which is set to 343pt so around 12.1 cm (or 121 mm)
the height which is set to 340pt so around 12.0 cm (or 120 mm)

When you export this template at 300 dpi the width is set to 1429. 1429 pixel / 300 pixel per inch = 4.76 inches = 12,1 cm.
And the png meta that stores the dpi ( = 'Phys') is set accordingly. So if your software is able to read the Png format (and the 'phys' meta) there should be no problem.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Is it possible to set the resolution in a template?

Postby Moini » Mon Nov 06, 2017 3:01 am

For export resolution, I was actually wrong. The value that you use for exporting the whole page (do this once to set it) seems to have preference over the one in the preferences file. The value that is saved to the preferences file is extremely 'unstable' (if the one for the whole page is not set in the SVG file) - it already changes when you change the value in the dialog only (don't even need to use that value), and then close Inkscape. It's a bit weird, to have a preference that isn't durable. But probably they didn't want to add even more options (like : take from file, if defined - always use this value - ...)

BUT I think the above is irrelevant, as I suspect the OP was either asking about importing bitmap images, or about the file's resolution.
Here's a related FAQ link, maybe that helps:
https://inkscape.org/en/learn/faq/#inks ... rogram-xyz
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Uaneme
Posts: 9
Joined: Tue Oct 24, 2017 7:51 am

Re: Is it possible to set the resolution in a template?

Postby Uaneme » Mon Nov 06, 2017 7:23 am

Thanks guys!
Now i need some time to figure out the facts and how to get to the next step.

I can give a few examples how things go wrong with inkscape and other softwares due to DPI weirdness.
Not sure who to blame, i guess W3C is the main reason, And then a secondary reason that every software seems to have a different workaround due to not understanding the logic of W3C.

Example 1.
Make a vector drawing in inkscape, and import it in makercam.com
Makercam is now using 96DPI as default was once 90DPI... So there is another confuser to all of this...
When inscape is set to 72DPI (on a Mac or instance) or to whatever other DPI then the size comes out wrong in makercam? I understand that makercam also made changes so i'm not sure if this is still an issue.

Also importing inkscape SVG files in other CAD software, FreeCAD LibreCAD. Fusion 360 or Adobe Illustrator for that matter also has its weird side effects.

Example 2.
Fritzing vs Inkscape.

Many of the Fritzing devs use Illustrator on a Mac to design parts for Fritzing.
If i'm not mistaken they want designs from Inkscape to be in 72DPI to comply and match with their scale size.
I have not used Fritzing for some time now so all can be different yet again by now.

What i never understood is why on earth i had to tinker with DPI values in the first place.

This is why i'm seaching for a solution to make A CNC template, and a Fritzing template that takes care of this since it is very frustrating when you put time and effort in drawing a complicated part only to discover that the DPI was still set to a wrong resolution. but when you change it to the correct resolution then the scale turns out to be wrong.

For Fritzing you need for instance Trace width and pad spacings to be accurate and they scaled wrong when you changed the DPI.

Now Inkscape is a few updates advanced since i tried this. So i really need to verify the current state of all this. If i ever have time to do so...

It would be more logical is 1mm is always just 1mm, 1 inch is always 1 inch and that DPI stuff is calculated from there, not the other way around.
Real world units never change in the real world, (unless we fall into a black hole)

I hope i'm the one who misunderstands something...

My main concern is to be able to work in metric units and not having DPI weirdness as a surprise.

I'm now back to reading the previous posts again and try to get it all into my brain somehow. I'm severely confused by this DPI stuff and it's very hard to see the logic. Maybe it's just a simple thing that i'm doing wrong. Or another setting that i have messed up in the past?

Thanks once again.

Uaneme
Posts: 9
Joined: Tue Oct 24, 2017 7:51 am

Re: Is it possible to set the resolution in a template?

Postby Uaneme » Mon Nov 06, 2017 7:53 am

@moini:

Thats what i thought. :-) This is why i'm so confused why things go wrong when inkscape is set to 'the wrong DPI'
I just discovered that on the PC i use right now (Ubuntu 14.04) there is Inkscape 0.91 installed, and on my own machine I have 0.92
And on this machine the DPI is still on the 'old' default 90DPI...

The FAQ topic is exactly the problem issue. Why on earth does another software not see the correct size DUE TO DPI madness??
OK i'm going to read that 10 more times... It just does not compute between my ears..
I mean i draw vectors in a vector program save the SVG, open the SVG in another vector based program and... the scale is no longer the scale I designed the drawing in?? When i set inkscape to metric mm and the CAD software loads the SVG then it should see that inkscape was set to metric mm NOT DPI whatever....
I'm so sorry that i'm not getting it. Please don't pull out your hair when you read this...

This is the very thing why it would make sense to have templates that can be set to some DPI value.
The script tab in the template (document preferences), can't i use that to set the DPI values with some kind of command line magic?

I mean why should i manually walk trough and set the entire preferences when i use Inkscape for CNC,
Then when i draw something for Fritzing i need to manually walk trough the entire circus again.
and then when I draw something for yet another case, i need to check all that yet again??

This is why i would expect to be able to make templates for CNC, Fritzing, whatever..

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Is it possible to set the resolution in a template?

Postby Moini » Mon Nov 06, 2017 7:57 am

Answer to previous post (there was a reply in between ^)

Inkscape 0.92.2 uses the same dpi value on all operating systems. 96 dpi is used for conversions between any units and px - that should be perfect for Makercam now :-) For best results (if Makercam or the conversion program has difficulties with the new default mm template), use the px template, and change the display unit to whichever unit you need to make your design in.

If you need 72 dpi, use the 'pt' template, or follow the steps outlined in the linked FAQ item.

You only need to tinker with dpi because the programs that read Inkscape's (standard conformant) output (or those that convert it to a different format) do not support the full SVG spec (i.e. they only read the numbers in the file, and assume a unit for them, instead of deriving correct values from the viewbox and the document width and/or height given in the document).

A mm is still a mm, in Inkscape and in the real world :) Just somewhere along the way to your etching, something is using a wrong ruler.

Read the full story on one of our core developers' patreon account:
https://www.patreon.com/posts/units-part-i-13563546 (part 1, goes up to part 4)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Is it possible to set the resolution in a template?

Postby Moini » Mon Nov 06, 2017 7:59 am

The good news is: the templates already exist. We can keep our hair ;-)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Uaneme
Posts: 9
Joined: Tue Oct 24, 2017 7:51 am

Re: Is it possible to set the resolution in a template?

Postby Uaneme » Mon Nov 06, 2017 8:01 am

Moini wrote:The good news is: the templates already exist. We can keep our hair ;-)


hehehe

But Is it possible to set the DPI in the template? That's the question...

I'll keep quiet for today, I still have to read most of the links everyone posted. It now looks like the other applications use the wrong rulers.
i'm going home now and test what happens if i use the latest Inkscape .92 and then see what happens if i open it in makercam.com, FreeCAD, LibreCAD etc

Uaneme
Posts: 9
Joined: Tue Oct 24, 2017 7:51 am

Re: Is it possible to set the resolution in a template?

Postby Uaneme » Mon Nov 06, 2017 8:40 am

v1nce wrote:NO.

You can't save dpi information in template, so the name "CD Cover 300dpi" is just pure nonsense. I reported a bug.

The only informations in the template are :
the preferred unit is set to "pt" (one of those strange unit that should have died a long time ago) which is around 0.353 mm.
the width which is set to 343pt so around 12.1 cm (or 121 mm)
the height which is set to 340pt so around 12.0 cm (or 120 mm)

When you export this template at 300 dpi the width is set to 1429. 1429 pixel / 300 pixel per inch = 4.76 inches = 12,1 cm.
And the png meta that stores the dpi ( = 'Phys') is set accordingly. So if your software is able to read the Png format (and the 'phys' meta) there should be no problem.


Ok, it would have made sense to have an option to set DPI values in a template, just for this stuff.
I'm still trying to wrap my head around why an svg made in 90DPI is seen different by other software then an svg made in 96DPI...
When inkscape was set to metric mm in the first place... BUT.. that was when i used an older version of Inkscape. I need to check what happens now.
Those are a few variables that I initially overlooked. ..the software versions

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to set the resolution in a template?

Postby v1nce » Mon Nov 06, 2017 8:43 am

Uaneme wrote:
Moini wrote:The good news is: the templates already exist. We can keep our hair ;-)


hehehe

But Is it possible to set the DPI in the template? That's the question...



and NO is the answer

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Is it possible to set the resolution in a template?

Postby Moini » Mon Nov 06, 2017 9:18 am

NO would be the answer, if the programs would read the SVG files correctly. But many don't, so they can be cheated.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to set the resolution in a template?

Postby v1nce » Mon Nov 06, 2017 10:49 am

The answer is NO it can't be done using templates in inkscape.
And NO you shouldn't have to specify DPI in Vector world because DPi makes little sense in vector worlds.

The DPI is usefull only when printing (that only (very few) printers get it right)
The PPI has never been usefull because nobody ever took time to calibrate the screen when it would have been usefull and when screen become able to communicate the right info to the PCs [*] then 1 size fits all value was chosen.

What makes sense is -correctly- settings the scale for the unit and inkscape does.
[EDIT]inkscape does it IF you start with a mm,cm template. With other templates it seems it uses pixels for viewbox which is bad. I'll investigate this tomorrow

* I just check and my X Server returns false (fixed ?) values of 96 DPI when my physical DPI should be around 101. So after more than 20 years this is still no good.
[/EDIT]

Uaneme
Posts: 9
Joined: Tue Oct 24, 2017 7:51 am

Re: Is it possible to set the resolution in a template?

Postby Uaneme » Tue Nov 07, 2017 6:40 am

Ok thanks, it's slowly sinking in...

Let me change the nature of the question, What do i need to understand to be able to explain in a correct manner how other softwares should deal with this.

What pointers are set in SVG that other software should use to get things right?

The only one i finf in the XML is "inkscape:document-units" but that seems to be an Inkscape specific setting...
I would expect a 'real' SVG setting that is used globally. If you know what i mean.

Also the "inkscape:document-units" appear only to be affected when you change the units in document propperties.
Many people seem to think that it is enough to change the unit setting in the main screen.

Then there is the default Template that used px as the default setting there the page itself is defined in mm (297x210mm)

So for CAD users this is a bit annoying. Specially for people who getting started with CAD. They prefer to start with inkscape (that's actually a good thing, and it shows that Inkscape is doing an excellent job in the intuitive department) :-)

That said, I'm still trying to figure out what i should be setting in a template to make life as easy as possible for people who want to use Inkscape for their first 2D CAD drawings, This would make their first steps into CAD less painfull (As is wastes real world resources.) But it would also make them enjoy the Inkscape experience a bit more. And hopefully draws in more clever people into this community.

For CAD Inkscape is great, but far from ideal. Still if Inkscape helps people to get started with CAD in a less complicated way then actual CAD software then i have to say. Well done Inkscape community! :-D


Apart from that the DPI stuff remains to be a confuser of he worst kind.
Add to that the confusion in DPI and PPI.

Printed media generally is in DPI Dots, and display media in PPI Pixels (EDIT: and CAD in MM or Inch)

Yet Inkscape appears only to speak about DPI, ALSO in area's where there is actually spoken about PIXEL resolutions to match display depictions to real world units. Maybe this could get some extra attention in Inkscape?? Use DPI when there is spoken about printing media and use PPI when there is a need to match the display output to real world units.

I think i say something very significant here, but I'm not familiar enough with the Inkscape community to know if this detail will reach the people who can make sweet candy of this.

If i design on a 210 PPI display it would be nice if a mm is then displayed in real world scale if i set inkscape to 100% (although this also would depend on the settings to be correct in the OS itself)
Then if I use a printer that prints at 300DPI then it would also be nice to get that output rendered in real world units.

And the workarounds that are messing with those units now seem to be causing the issues that I came here for. Plus an unhealthy amount of confused brainwaves of my own. (My apologies for that mess)

Still i remain very thankful to have Inkscape available to me regardless of all the little annoyances. Keep up the good work guys!

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Is it possible to set the resolution in a template?

Postby tylerdurden » Tue Nov 07, 2017 7:45 am

You might try digesting this:
http://wiki.inkscape.org/wiki/index.php ... n_Inkscape

It is akin to the 4-page tome, but less ranty.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to set the resolution in a template?

Postby v1nce » Tue Nov 07, 2017 8:04 am

good
<svg ... width="210mm" ... height="297mm" ... viewBox="0 0 210 297">...</svg>
the viewbow is splitted into 210 horizontal units and the width is 210mm => unit = mm
the viewbow is splitted into 297 vertical units and the height is 297mm => unit = mm

less good
<svg ... width="210mm" ... height="297mm" ... viewBox="0 0 21 29.7">...</svg>
the viewbow is splitted into 21 h units and the width is 210mm => unit = cm

even less good
<svg ... width="210mm" ... height="297mm" ... viewBox="0 0 100 100">...</svg>
the viewbow is splitted into 100h units and the width is 210mm => unit = 1/100th of page width = 2.1mm
the viewbow is splitted into 100v units and the height is 297mm => unit = 1/100th of page height = 2,97mm
=> the unit "dot" is a rectangle and not a square

confusing
<svg ... width="210mm" ... height="297mm" ... viewBox="0 0 8.22 11.62">...</svg>
the viewbow is splitted into 8.22 units and the width is 210mm => unit = 1/8.22 of 210 mm = 25.54mm = 2.554cm =1 inch

deprecated
<svg ... width="210mm" ... height="297mm" ... viewBox="0 0 0.46 0.66">...</svg>
the viewbow is splitted into 0.46 units and the width is 210mm => unit = 1/0.46 of 210 mm = 2.17 * 21cm = 45 cm = 1 Meh Nedjes (ancient egyptian measure)

imperial nonsense
<svg ... width="11in" ... height="17in" ... viewBox="0 0 11 17">...</svg>
the viewbow is splitted into 11 units and the width is 11 inches => unit = 1 inch = 2.554cm = 25.54mm

garbage in garbage out
<svg ... width="1000" ... height="1000" ... viewBox="0 0 1000 1000">...</svg>
as the width is unitless then all interpretations are possible. Depending on your version of inkscape and settings it could be interpreted as 90 pixels equal 1 inch so 1 pixel = 1 unit = 1/90th of inch = 0.28 mm. And width = 1000 * (25.54 mm/90) = 283 mm.


as -I suppose- other tools are not SVG compliant (=don't care at all about reading the width and height) the last case applies.

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to set the resolution in a template?

Postby v1nce » Tue Nov 07, 2017 8:49 am

Make sure you start with a sane template (one where the unit is defined) (check that there are units in the svg with and height by looking at the xml (launch xml editor with shift ctfl x))

import it in your cad tool

If the dimensions are right
...this never happens...
else
[that's probably because it didn't read the units in width.]
If it didn't accept you to set the (so-called) DPI then you're out of luck
=> fill a bug report about svg import failure
else
fill a bug report too.
compute the DPI :
you used mm (or other sane metric unit), it sees it at pixels => you need to go from mm to pixel.
1 mm = 1 pixel @ x DPI => 1 pixel = 1 mm = 1/DPIth of inch => DPI = inch in mm = 25.54
(100 units = 100mm = 10cm = 3.9 inches and 3.9 inches @ 25.54 DPI = 3.9 * 25.54 = 100 "dots" over 3.9 inches = 100 dots per 10 cm <=> 1 dot = 1mm)
or
1cm => DPI = 2.554
or
1inch => DPI = 1

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Is it possible to set the resolution in a template?

Postby Moini » Tue Nov 07, 2017 9:11 am

The only one i finf in the XML is "inkscape:document-units" but that seems to be an Inkscape specific setting...

Correct. This only changes the units that are used for displaying values in the Inkscape interface, e.g. the width/height entry fields in the rectangle tool's tool control bar.

Then there is the default Template that used px as the default setting there the page itself is defined in mm (297x210mm)


The default template in Inkscape 0.91 used px, the one in 0.92 uses mm as the unit that is used in the SVG code.

The settings for your optimal template depend on the capabilities and assumptions of the specific CAD application that is meant to work with it. There can't be one single template to account for all those different bugs/silent assumptions those different applications have and make.

As for the 100% real-world-size view, there's actually a setting for that in Inkscape's preferences. Only the way it works is not intuitive. Go to Edit > Preferences > Interface, and hold a ruler to your screen until it fits. The zoom level that this corresponds to can then be called by pressing 1 on the numpad - which is not 100% then (because ... I don't know why it's not possible to just do that multiplication silently in the background), but the level that was determined by your ruler-on-screen action.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”