PNG export changes selection dimensions

Asked by Robin

I've only just noticed that when I export to a PNG the Bitmap size does NOT automatically / necessarily conform to the size of the selection in Inkscape! Inkscape changes the dpi for some reason, to crazy things like 91.66. If you change the dpi back to 91 (standard resolution?) the size of the bitmap will no longer match the size of the selection. If you don't realise this and specify the dimensions of say an src ref to be the dimensions of the SVG export then the browser with rescale the actual image as appropriate resulting in a loss of quality.

Can anyone explain how to get the inkscape image slection dimensions and those of the exported bitmap to be identical?

For instance, if I wanted an image to fit into a certain space exactly on a webpage, how would I be able to calculate or ensure that the selction being exported woul fit those dimensions? At present I would have to create the image, see in the export dialogue how much it needed tweaking and go back and forth until I managed to get the right dims.... I MUST be missing something, right?

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
sas
Solved:
Last query:
Last reply:
Revision history for this message
Robin (talvenloppu) said :
#1

There's something else happening here! The dpi of 91.66 keeps coming up. I notice that it's attached to a number of objects within my SVG drawing/file.

It's easy to reset the dpi in the export dialogue, but grouping objects in any way makes them take on the 91.66 dpi resolution again. This happens even if the objects are grouped temporarily, for instance to align them in some way.

It's surprisingly easy to get around. Simply reset the dpi to 91 and as the export dialogue box stays on top this allows resizing of the objects in the underlying window.

If you don't do this the bowser resizes and the PNG's lose focus.

Revision history for this message
Best sas (sas-sas) said :
#2

The standard dpi in Inkscape is 90 (not 91). If you use 90 dpi in the Bitmap Export dialog, then the width and height of the PNG should match the width and height of the selection (assuming the width and height of the selection are whole numbers, of course). At least, this works for me.

I also find that it remembers the last dpi used, so I don't know why you keep getting 91.66 if you never use that.

Revision history for this message
Robin (talvenloppu) said :
#3

Great sas thanks - I noticed that in the Preferences the dpi was set at 90 dpi - Looking at various objects most come up at 91.66 dpi though some are 91...

Any idea why grouping objects makes the dpi change back to 91.66? I've never changed the dpi setting st all - that's why all my PNGs on my sites looked so naff!!! and I've only just realised.

Hey and I realise you're one of the authors of this incredible thing! O= Thanks :) It must be if not the best then one of the very best pieces of software out there.

Revision history for this message
Robin (talvenloppu) said :
#4

Thanks sas, that solved my question.

Revision history for this message
sas (sas-sas) said :
#5

The problem is that Inkscape remembers the dpi last used for each exported selection, and somehow you used 91.66 on most of them. If you export them all again at 90 dpi, then Inkscape should remember that in future.

> Any idea why grouping objects makes the dpi change back to 91.66?

I think that only happens if the remembered dpi for one of the objects in the group is 91.66.

> Hey and I realise you're one of the authors of this incredible thing!

Well, not really - I've done some things that will be in 0.47, but there's nothing of mine in 0.46 (except a minor bug-fix).

Revision history for this message
Robin (talvenloppu) said :
#6

Thanks for your reply (and thanks anyway for your part in Inkscape!) I hope upgrades don't lose the intuitive ease of use that makes inkscape so good. Compare with GIMP for an example of what a mess you can get into! LoL

I don't understand the point of the dpi settings. All they seem to do is change the bitmap size. Changing the bitmap size changes the dpi and changing the dpi changes the bitmap size, so the "resolution" stays the same whatever you do. If 90 dpi is the way Inkscape sees the world then why not simply have it fixed at that? However if it were possible to crank up the dpi to get a higher res of the exported image then I'd use that.

I've also noticed something screwy that happens, probably as a result of this dpi thing. I pasted some images from a mozillazine article into Inkscape, made freehand notes/markup on them using the calligraphy tool and then exported the thing (as a selection), only changing the filename/path of the output. I never used it (great community but the knowledgebase is that typical combination of too much detail AND too little (contrast with Tav's manual for this!!). I looked at it today and found that the markup is out of alignment with the pasted bitmap. All the markup (the calligraphy pen stuff) has been "shrunk" in the export in relation to the imported bitmaps! FWIW :)

Thanks again sas

Revision history for this message
sas (sas-sas) said :
#7

I agree that Inkscape's handling of dpi doesn't make much sense.

I don't know what could have happened to your marked-up mozillaZine images. That sounds like a bug.