Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any program under linux where I can do the following:

Suppose I have for example a scan of a drawing on a squared paper and suppose that the squares of the original paper have any distance but not 0,5 cm.

Now I want that the squares of the output picture have a distance of exactly 0.5 cm.

I tried to include the picture to inkscape and use the ruler to rezize the picture appropriately but this was a pain.

I think something like this would be great: Have a "distance tool" where you can select two points of a picture (for example two vertices of my squared paper squares) then you define that the distance between those points should be say 0.5 cm then the whole picture should scale appropriately while preserving aspect ratios.

Note that I am mainly interested in a solution where I don't have to measure the distance on the original paper using a physical ruler or something like that.

Edit Finally I want a DIN A4 pdf including my picture and print it. In my example the point is that the distance of the squares should be 0.5 cm in the printed version...

share|improve this question
i think you will save yourself huge headaches if you start thinking in terms of DPI (en.wikipedia.org/wiki/Dots_per_inch). – ixtmixilix Sep 17 '12 at 16:42
@ixtmixilix Does this help if I don't want to use a physical ruler for the original paper? – student Sep 17 '12 at 17:02
up vote 2 down vote accepted

My answer starts where ixtmixilix comment ends and assumes that you have installed ImageMagick.

To get a pdf with the right resolution/density you need the margin/squares in Pixels, call it p. You can get this via gimp, inkscape, any other reasonable image editor/viewer or indirectly by the dpi of the used scanner multiplied by the real distance in inch.

If you want the new margin to be xcm's the formula for the resolution/density is

r = p / x

To build the pdf you have to invoke

convert <your_picture> -density <r> -units PixelsPerCentimeter \

Now you can print the pdf or embed the generated pdf in a latex document, etc. The previously adjusted resolution remains.

share|improve this answer
Just for completness: In gimp one can use the Measure Tool, in inkscape I don't know how to do it. – student Sep 17 '12 at 18:00
Thanks this works if I choose pdf as output format for the convert command as you suggested. Since I have to embed the result somewhere else to generate the final pdf I just tested do use png as output format and embed it in inkscape. However this doesn't work. Any idea why? – student Sep 17 '12 at 18:20
I found out that this is actually discussed on the inkscape bug tracker under the title png resolution not imported. It seems that several workarounds exists and a patch. Maybe you can find there further hints. – user1146332 Sep 17 '12 at 18:44
Is it also possible to modify the convert command to get the picture centered in an A4 pdf (without quality loss) – student Sep 17 '12 at 18:51
I don't know but you can adjust this via the standard gtk printer dialog. – user1146332 Sep 17 '12 at 18:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.