DPI calculation to compensate for incorrect zoom settings

Don't know where to start, or stuck on a certain problem? Drop by and tell us about it. Feel like helping others? Start here.

Moderator: peterZ

Post Reply
tkr
Posts: 35
Joined: 29 Jan 2012, 21:53
Number of books owned: 0

DPI calculation to compensate for incorrect zoom settings

Post by tkr »

Hello,

I was taking pictures of a book, paper size 8.5"x11". As I only have one camera, I shot all the L pages first, followed by all the R pages.

I then realized that I had inadvertently shot both sides using different zoom settings.
L = 2173x2834 px,
R = 2480 x 3285 px.

My dilemma: what should I do to have both images print out on a 8.5x11" paper so as to have the same physical size ?

I believe I can use the following imageMagick command to change the DPI of an image
convert IN.jpg -density AxB OUT.jpg (where A and B are the xDPI and yDPI respectively).
It seems like I ought to have the X and Y DPI's be the same value, to avoid distorting the image.

My question: what value of DPI should I program in ?

Tks,
TKR
User avatar
Heelgrasper
Posts: 70
Joined: 19 Feb 2012, 21:04
E-book readers owned: None
Number of books owned: 500
Location: Randers, Denmark

Re: DPI calculation to compensate for incorrect zoom setting

Post by Heelgrasper »

Before making this very complicated I just want to mention what I would do with the software I'm using since I had a similar problem the other day.

It was a short book so I fixed it in ScanTailor by setting the DPI manually for one half of the pages. Don't think there's a easier way in ScanTailor since you can't mark a set of photos and set the DPI for that set. If I was to do it again with a larger book I would batch process one set of the images so that a single pixel was cut of since that should make it possible for me to give that set a different setting for DPI in ScanTailor. People should feel free to correct me on this.

And now for the more complicated. First of all I should explaing why I can't give a simple answer to your question at the bottom. You say the pages are 8.5'x11''. That means that the ratio is 8.5/11 = 0,772727273 . Then you have one set of photos at 2173x2834 pixes, so a ratio at 2173/2834 = 0,766760762 . And another set of 2480x3285, a ratio of 2480/3285 = 0,754946728. So somewhere both sets seems to a bit off on the pages. Not a big problem but that means we can't just calculate from the page size and the pixels you mention. Well, we could since it's not a huge difference but I wont - yet.

To calculate the DPI you simply measure something on the physical book that you can measure on the photo as well. The entire text block or a few lines would be fine. Then you measure the exact same thing on the photo. In most programs like GIMP, Paint.NET etc. you can make a selection and then see the dimensions of the selection in pixels. Remember to measure the exact same (top of big letters, top of small letters, bottom of letters etc). Then you divide the number of pixels with the measurement of the physical book in inches. This should give you the exact DPI for the page.

Repeat for the other set of images and now you should have the correct DPI.

And yes, the DPI should be the same for both X and Y.

Just for the fun of it: If the photo sizes you mention covers perfectly the 11'' of the book the DPI should be 257.636364 and 298.636364. If it covers the 8.5'' perfectly it should be 255.647059 and 291.764706. So in rounded numbers the first set is either 258 or 256 DPI and the other set either 299 or 292 DPI. A difference of up to 3-4 DPI is rather insignificant but 7 isn't. At least in my book.
---
Jakob Øhlenschlæger
Randers, Denmark

The past is a foreign country: they do things differently there
L. P. Hartley
tkr
Posts: 35
Joined: 29 Jan 2012, 21:53
Number of books owned: 0

Re: DPI calculation to compensate for incorrect zoom setting

Post by tkr »

Tks for the response -

Left pg: (zoomed out too far, so I had to crop the extraneous bits out, giving me smaller X and Y pixel dimensions of the page content)
Xdpi = 2173/8.5 = 255.64
Ydpi = 2834/11 = 257.63

Right pg:
Xdpi = 2480/8.5 = 291.76
Ydpi = 3285/11 = 298.63

a) Assuming that I set the same DPI for both X and Y dimensions:
L page = 256.6 x 256.6
R page = what do I set this to ?

b) After thinking a bit, I'm not convinced that the X and Y DPI should be made the same, particularly if the tool allows you to specify different DPI's for X and Y.
I know the dimensions of the physical page are 8.5"x11". The pixel dimensions of the page can be any value, (dependent upon zoom and how much is cropped etc) - Whatever is the aspect ratio of the picture, it is the correct value, since it correctly represents the page dimensions on the screen (i.e. looks proportional, not skewed or elongated). In other words, I don't think there needs to be any correlation between aspect ratio of the physical page, and the aspect ratio of the picture. I could be way off base here, and would welcome any correction.l
Does Gimp or any of the other tools, provide a way to find out the physical size at which a picture will print (given the DPI) ?
User avatar
strider1551
Posts: 126
Joined: 01 Mar 2010, 11:39
Number of books owned: 0
Location: Ohio, USA

Re: DPI calculation to compensate for incorrect zoom setting

Post by strider1551 »

tkr wrote:Does Gimp or any of the other tools, provide a way to find out the physical size at which a picture will print (given the DPI) ?
GIMP does. Image -> Print Size, then just fool with the width/height or the x/y.

Sorry, I haven't read through the rest of the thread to know what all you're asking. I just saw that at the bottom and thought, "hey, there's a simple answer to that."
User avatar
Heelgrasper
Posts: 70
Joined: 19 Feb 2012, 21:04
E-book readers owned: None
Number of books owned: 500
Location: Randers, Denmark

Re: DPI calculation to compensate for incorrect zoom setting

Post by Heelgrasper »

tkr wrote:
b) After thinking a bit, I'm not convinced that the X and Y DPI should be made the same, particularly if the tool allows you to specify different DPI's for X and Y.
I know the dimensions of the physical page are 8.5"x11". The pixel dimensions of the page can be any value, (dependent upon zoom and how much is cropped etc) - Whatever is the aspect ratio of the picture, it is the correct value, since it correctly represents the page dimensions on the screen (i.e. looks proportional, not skewed or elongated). In other words, I don't think there needs to be any correlation between aspect ratio of the physical page, and the aspect ratio of the picture. I could be way off base here, and would welcome any correction.l
Try looking at it this way:

In an ideal situation you'll have the sensor of the camera parallel to the book page and the field of view is tranferred with no distortion to the sensor. The sensor produces an image consisting of pixels. Pixels are square. That means that one inch on the book page translates to given number of pixels in the image. Doesn't matter if it's X or Y. Only way that could happen is if pixels weren't square and they are. http://www.scantips.com/basics1b.html has a few examples showing that.

If the DPI really was different for X compared to Y the image would look distorted on your screen since for example a 1 inch square would be 250x300 pixels. It might be harder to notice if it was 295x300 pixels but still wouldn't be a square.

Scanners are a different beast. I had a scanner that could scan at 2400x1200 DPI. Had I scanned something like that I of course would have had to set the DPI for two different values for X and Y. Never really unstod that concept and never used it but that's another story.
---
Jakob Øhlenschlæger
Randers, Denmark

The past is a foreign country: they do things differently there
L. P. Hartley
tkr
Posts: 35
Joined: 29 Jan 2012, 21:53
Number of books owned: 0

Re: DPI calculation to compensate for incorrect zoom setting

Post by tkr »

Heelgrasper,
Thank you for the information (that link seemed to be quite detailed - will go through it too)
I'm also going to try to actually print out both images (XY dpi same, and XY dpi different) so that I can actually see the difference with my own eyes.

So in conclusion:
a) Calculate DPI for each page (L & R) separately - no need to try to force both pages to have the same DPI
b) On a particular page, where Xdpi differs from Ydpi, and one is looking to put in the same value of DPI for both x, y dimensions, what values of DPI do you choose ?
Eg: In the case above, 291 DPI, 298 DPI , what value of DPI to use ?

TKR
Anonymous2
Posts: 97
Joined: 18 Oct 2011, 16:05

Re: DPI calculation to compensate for incorrect zoom setting

Post by Anonymous2 »

Whenever I had page sizing issues, I usually just found the most convenient size and scaled all of the pages down to it. Zooming shouldn't affect the aspect ratio (for you it did, oddly) so scaling down shouldn't be much of a problem, but the horizontal/vertical compression might be noticeable.
tkr
Posts: 35
Joined: 29 Jan 2012, 21:53
Number of books owned: 0

Re: DPI calculation to compensate for incorrect zoom setting

Post by tkr »

Anonymous2,
how were you able to scale down to a different size ? An example of a command that you used (ImageMagick/Gimp) would be very helpful.
Tks
TKR
Anonymous2
Posts: 97
Joined: 18 Oct 2011, 16:05

Re: DPI calculation to compensate for incorrect zoom setting

Post by Anonymous2 »

I just used this:

Code: Select all

mogrify -resize widthxheight! *.JPG
It overwrites your existing images so make sure to work on a copy. The exclamation point at the end forces ImageMagick to scale to that exact size, ignoring aspect ratio.
Post Reply