Saturday, November 19, 2011

Use IrfanView and Paint to Collate Multiple Scanned Picture

Recently I wanted to scan a drafting drawing in to allow me to trace it in AutoCAD instead of having to do so much hand scaling.  (For instructions on how to attach a raster image (like a scan) to an AutoCAD drawing, see here.)  But before I can do this tracing, I need to put the image together and there are some problems – for which I have found acceptable solutions.

Problem 1:  My scanner isn’t big enough to scan the whole drawing in one fell swoop. 

Solution 1:  Scan the document (in this case, the drawing) in several overlapping places.  Overlap is desirable to ensure proper matching of parts of the drawing.  Obviously, you must scan every part of the source document unless you are willing to make due without having certain parts of the drawing, or can fabricate such parts readily.


Problem 2:  The resulting scanned in images are crooked – meaning, they are at an angle.


Solution 2:  To straighten the images, you can use a free program called IrfanView – together with the IrfanView plugins.  After you have installed the program (don’t bother with the file associations steps in the install – choose no file associations; at least, that’s what I prefer so far):
  1. launch IrfanView and open up a picture you want to “straighten out.”
  2. determine the amount and direction of rotation necessary to correct the misorientation:
    1. hover mouse pointer over part of a line that is supposed to be horizontal (or vertical) – aim for the middle of the thickness of the line and an extreme end (left, right, top, or bottom)
    2. press and hold left mouse button
    3. with the left button still depressed, move mouse pointer over to the opposite end of the same line (or one which is supposedly aligned with it)
    4. when pointer is over the center of the thickness of the opposite end of the line (or other chosen destination), release the left mouse button
    5. in the title bar, you will see some information:
      1. blah blah blah (Selection: x_position, y_position; x_dim x y_dim; blah)
      2. we need the x_dim and y_dim (as in, dimension)
    6. Calculate tan-1(x_dim/y_dim) or tan-1(y_dim/x_dim); choose the option with the smaller of x_dim or y_dim in the numerator.  You will use a positive number if you need to rotate clockwise or take the negative of the number if you need to rotate counter-clockwise.
  3. go to the image menu and select Custom/Fine rotation…
  4. Select a background color for infill.  When the picture is rotated, it will leave a blank space.  This blank space can’t just be blank per se – it needs to have some color or other.  Here is where you select that color.
  5. Enter the number of degrees to rotate – use the value and sign determined in step 2.6.
The rest of the process is straightforward, albeit tedious and can be done in most picture editing software, including MS Paint.  Open the destination image up and enlarge it.  Open the source files (one at a time) and select all, copy.  Then paste those images into the destination image file and move the image around as desired.  It may take a bit of thinking and practice to feel comfortable with the process.  This will not get you beautiful results most of the time, but it can produce a picture to trace over with a proper drawing or drafting program.
Post a Comment