save in original dimensions?

Post questions on how to use or achieve an effect in Inkscape.
Reitanna
Posts: 3
Joined: Thu Jun 13, 2019 7:07 am

save in original dimensions?

Postby Reitanna » Thu Jun 13, 2019 7:12 am

This has bothered me for a long time. Say I drag an image into Inkscape that is 1280x720, and I resize the document to fit the object. Then I draw something, hide the image I dragged in, and then save the SVG file. Then I open the SVG file in my internet browser so I can save it as a transparent PNG. I need it to STAY 1280x720, but it comes out bigger. How on earth do I fix this?

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: save in original dimensions?

Postby Lazur » Thu Jun 13, 2019 9:14 am

Hi.

Look more into the document settings.

The default template has a display unit in mm and scale factor is set to 1.
In addition, inkscape runs at 96 dpi. Thus can easily lead to some mismatch if your page size is set by mm and rendered by a browser at 72 dpi.


So, when you pull in that image:
1.: set display units to px
2.: set scale factor to be 1 (so then 1 user unit will be exactly 1 px)
3.: resize your raster image's height/width to be 1280/720 px
4.: resize page to content

preferably
5.: select all (Ctrl+A) and cut (Ctrl+X)
6.: create new layer in the layer dialog (Shift+Ctrl+L), delete current layer
7.: paste in position the objects from the clipboard (Ctrl+Alt+V)

These last 3 steps should ensure your svg doesn't have any unnecessary/bogus additional transformation matrices.

Reitanna
Posts: 3
Joined: Thu Jun 13, 2019 7:07 am

Re: save in original dimensions?

Postby Reitanna » Thu Jun 13, 2019 9:49 am

i don't see anywhere that says "scale factor"

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: save in original dimensions?

Postby druban » Thu Jun 13, 2019 11:50 am

Reitanna wrote:Then I open the SVG file in my internet browser so I can save it as a transparent PNG. I need it to STAY 1280x720, but it comes out bigger. How on earth do I fix this?


Lazur has addressed your question but I just wanted to mention that this step is totally unnecessary; inkscape can easily save a SVG as a transparent PNG of precise dimensions. The document background has to be set to transparent ( 0 alpha) in the document setup dialog. Thereafter any PNG export will be transparent where there is nothing but canveas and partially transparent where the objects are partially transparent. If you export your PNG from Inkscape you can see the export dimensions in the dialog at the moment of export so there is no need for guessing or calculation!

In fact you can set your default file up like this and then all subsequent new files will be the same.
Your mind is what you think it is.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: save in original dimensions?

Postby Lazur » Thu Jun 13, 2019 3:43 pm

Reitanna wrote:i don't see anywhere that says "scale factor"


Then you are most probably not using the latest stabile version.

Switch to the most recent one now -or wait for a few months and go straight for version 1.0!

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: save in original dimensions?

Postby druban » Thu Jun 13, 2019 6:02 pm

look in Edit/preferences/interface to view and adjust for the 'zoom correction factor'. This has been in Inkscape for a long time so it may not be what is mentioned above as 'scale factor'.
However this factor uses mathematical recalculation and will generally result in decimal place dimensions. I recommend the method I described above to get precise pixel dimensions.
Your mind is what you think it is.

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

Re: save in original dimensions?

Postby Moini » Thu Jun 13, 2019 8:38 pm

And the only place where the zoom correction factor does anything is when you hit Numpad 1 ...
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)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: save in original dimensions?

Postby Lazur » Fri Jun 14, 2019 10:36 am

scale.png
scale.png (21.68 KiB) Viewed 1667 times


Return to “Help with using Inkscape”