Dpi v size in bitmap export

Asked by Andrew Wood

Thanks! great program.

 I am prob being very dumb, but when I go to save a bitmap, I cant get it to the size and dpi I want (ie if I adjust the dpi the size changes,and if I adjust the size the dpi changes. How do you export at a set dpi as well as size? thanks once agai, the software is great, keep up the amazing project,

Andrew Wood

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
pbhj
Solved:
Last query:
Last reply:
Revision history for this message
Johannes Lipp (jflipp) said :
#1

I assume that when you say "save a bitmap", you mean "export a bitmap".

Then, in the upper area of the export dialog, you can see, and adjust, the part of the Inkscape document you want to export.
This part has metric dimensions (that is, in mm or inch), width and height. Say, it has width = 50mm and height = 20mm.

If you want to export this part of the Inkscape document as a bitmap, you must specify how many pixels you want the bitmap to contain.

You can do this in one of three ways.

(1)
You can specify the width of the bitmap in pixels.
Say, you decide that the exported bitmap should be 1000 pixels wide.
Then the height of the bitmap is determined by the ratio height/width of the rectangular part of the Inkscape document you want to export. To avoid distortions, the exported bitmap must have the same ratio (assuming quadratic pixels).
So we have <height of the bitmap in pixels> / 1000 pixels = 20mm / 50mm.
Solving for the height of the bitmap, we get 400 pixels.
Inkscape calculates this automatically for you.
From the width of the bitmap in pixels and the metric width of the original rectangle in the Inkscape document, we also have the resolution, it is 1000 pixels / 50mm = 20 dots per mm. (Note: pixels are dots.)
If we recall that 1 inch is 25.4 mm, we can express this in dots per inch, namely 20 dots per mm = 20 dots * 25.4 per inch = 508 dots per inch.
Inkscape also calculates this automatically for you.
Note that if we calculate the resolution from the heights, we get the same value. That's because we preserved the ratio height/width.

(2)
You can specify the height of the bitmap in pixels.
Then you can calculate the widht of the bitmap in pixels and the resolution as described in (1), except that you have to swap width and height.
Again, Inkscape does this automatically for you.

(3)
You can specify the resolution.
From that you can calculate the width and height of the bitmap in pixels.
Say, you specify a resolution of 508 dots per inch.
The width of the rectangle you want to export is 50mm = 50 / 25.4 inch = 1.9685 inch.
At 508 dpi, this corresponds to 1.9865 inch * 508 dpi = 1000 pixels.
Similarly, the height of the rectangle you want to export is 20mm = 20 / 25.4 inch = 0.7874 inch.
Ad 508 dpi, this corresponds to 0.7874 inch * 508 dpi = 400 pixels.
Again, Inkscape calculates this automatically for you.

So you see that by specifying one of the three values width in pixels, height in pixels, resolution, the other two are fixed. You can't set them independently.

Also note that for the exported bitmap, resolution has absolutely no meaning. Everything that counts is the width in pixels and the height in pixels.
Resolution becomes interesting again if you do something with that bitmap, e.g. display it on a screen or print it out. Then we have the resolution of the screen or the printer. And from this new resolution and the width and height of the bitmap in pixels, you can calculate the metric width and height (that is, in mm or inch) of the bitmap on the screen or the printed page.

If you see all this for the first time, it might seem a bit confusing. But if you think about it, it will make sense. Or so I hope.

Revision history for this message
Andrew Wood (andrew-solochallenges) said :
#2

Hi Johannes,

Thank you for your detailed and comprehensive reply to my query.

The problem I had was when trying to export an image (png) for a web page, a logo that I had designed and wanted to be a specific size in pixels at a specific dpi,

 ie 50 x 50 px at 72 dpi.

As I had set the initial design resolution at 2000 x 2000 dpi, I get this automatic resizing of either dpi, or edge size, it doesn't seem possible to reset both figures, dpi and size?

This is where I'm stuck.

Thanks again,

Andrew

Revision history for this message
Johannes Lipp (jflipp) said :
#3

Hello Andrew,

I think I can give you some more explanations about your problem.
But first I'd like you to tell me how to set the initial design resolution at 2000 x 2000 dpi.
How do you do that?

Regards,
Johannes

Revision history for this message
Andrew Wood (andrew-solochallenges) said :
#4

Hi,

I simply went to the document settings and chose 2000 x 2000 pixels at what I assumed is the default 90 dpi.

So how do you go about exporting that graphic at a specific size of say 100 x 100 at 72 dpi?

Cheers,

Andrew

Revision history for this message
Best pbhj (pbhj) said :
#5

For a website it doesn't matter - a PNG at 50px will be rendered at 50px, web doesn't have a DPI; it's only when you come to print that out (if the PNG retains this in metadata) that you would have an issue.

To recap, it doesn't matter, the pixel size is the bit to look at.

Revision history for this message
Andrew Wood (andrew-solochallenges) said :
#6

Hi,

Thanks. I have always had a problem getting my head around dpi and px!

Just that everything I have ever done for web stuff I have always set to 72 DPI. I thought this was the standard dpi for web as it is not too large a file, yet the smallest you can get away with the eye not seeing as pixels.

I will just have to go away and get my head around the difference between screen res and print res!

Thanks for all your help.

Regards,

Andrew

Revision history for this message
jfgh dg (sdsyr33) said :
#7

The precision and speed of table saws allow woodworkers to work more efficiently, increasing overall productivity and output. See more detail here https://sawstrend.com/the-best-table-saw-reviews-2023/