It is currently Thu Apr 25, 2024 12:53 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Straightening a scanned image
PostPosted: Thu Nov 24, 2016 8:52 pm  (#1) 
Offline
New Member

Joined: Nov 24, 2016
Posts: 2
I have an image that I've scanned that I would like to straighten. The image is in a bordered box but the scan wasn't straight, so the image appears rotated. How can I straighten the image so the sides of the box are vertical and parallel as they should be?


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Straightening a scanned image
PostPosted: Thu Nov 24, 2016 9:16 pm  (#2) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13016
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
5891004821 wrote:
I have an image that I've scanned that I would like to straighten. The image is in a bordered box but the scan wasn't straight, so the image appears rotated. How can I straighten the image so the sides of the box are vertical and parallel as they should be?

You can put out some vertical and horizontal guide lines.
On the edge of the image.
Then use the Rotate Tool,
to rotate the image close to where it should be.

You can also use the Crop Tool,
to crop the image inside the borders.
Which will make it even,
or straight on all sides.

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Straightening a scanned image
PostPosted: Thu Nov 24, 2016 9:26 pm  (#3) 
Offline
New Member

Joined: Nov 24, 2016
Posts: 2
So it would just be by eye?


Top
 Post subject: Re: Straightening a scanned image
PostPosted: Fri Nov 25, 2016 4:10 am  (#4) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2424
5891004821 wrote:
So it would just be by eye?

There is a deskew plugin: http://registry.gimp.org/node/2958 Webpage gone but the tinyurl link seems to work. Might / might not work in windows.

edit: looks like some clever person posted a linux binary there.
If using Windows these are samj's deskew plugins.
https://dl.dropboxusercontent.com/u/105 ... -32-64.zip
Unzip, use the appropriate set of .exe and dll's for 32bit or 64 bit.

If you use linux and can compile this works for me
https://github.com/prokoudine/gimp-deskew-plugin

Otherwise there will have to be some human input

Using the rotate tool - set it to corrective mode and rotate the grid using the mouse. Line it up with an edge or text

Attachment:
corrective01.jpg
corrective01.jpg [ 106.64 KiB | Viewed 13055 times ]


applied looks like this.

Attachment:
corrective02.jpg
corrective02.jpg [ 122.27 KiB | Viewed 13055 times ]


Then there are scripts/plugin aids. Set a path to an edge or text, apply the plugin.
One is ofnuts ofn-layer-straightener.py http://sourceforge.net/projects/gimp-to ... s/scripts/ about 4 down. Un-zip pop into your plugins folder.

Set the path tool to polygonal mode to make it easier.

like this

Attachment:
of01.jpg
of01.jpg [ 107.84 KiB | Viewed 13055 times ]


Result is the same as rotate tool.

All this assumes that there is no distortion on the scan. Might have to apply a perspective transform to make absolutely rectangular.

edit: A quick video on the plugins and setting up some keyboard shortcuts to speed up the process if you have been using a sheet-feed scanner :)

https://youtu.be/IG9SAUBLKc0 2 1/2 minutes

_________________
Image


Top
 Post subject: Re: Straightening a scanned image
PostPosted: Sun Nov 27, 2016 1:18 am  (#5) 
Offline
GimpChat Member

Joined: Nov 08, 2016
Posts: 45
I do a lot of scanning too. The beds on the affordable scanners are so small, my images are always slanted. :-)

Steps:
1. Click the Measure Tool (so you don't have to eyeball it alone)
2. At the top of your bordered box, draw a line from one side to the other. You may want to zoom in. A quick way to zoom in is to hold the Ctrl key and roll the mouse wheel up and down. In the second video below, he wanted the bridge to be straight. The drawn line will be on an angle.
3. Look at the bottom of Gimp, in the status bar it will show the angle in degrees that you will want to correct.
4. Click the Rotate Tool.
5. Change Direction to Corrective because this ONLY moves the grid which helps you visually see what is going on. I'm not quite sure how Normal is used. It moves both. Show image preview should be checked.
6. Optional Change: Change Clippings to Crop with Aspect, and Number of lines
7. Click the image to display the Rotate Tool's dialog box.
8. Enter the angle value from #3. I entered it in with a negative sign (i.e., -2.18). I then clicked in the text field for "Center X:" so I could see the preview. The grid should have turned and the lines are parallel to your bordered box top (the one you measured). Make any adjustments if you don't like what you see. Click Rotate.
9. To verify, you can drag down a guideline from the top or measure again.
10. Depending on your Rotation options in #6, you may need to either crop the image or Image > Fit Canvas to Layers

A combo of these two videos helped me see how the Tools work and how they could be applied:
Straighten a horizon using rotate tool - GIMP Beginners' Guide ep45
https://www.youtube.com/watch?v=Kc79tmnw7_I
Gimp- Rotating Photos perfectly with Measure Tool
https://www.youtube.com/watch?v=aS70VvqxxcU


Last edited by vA+6Q-Hv[BX] on Sun Nov 27, 2016 4:06 pm, edited 1 time in total.

Top
 Post subject: Re: Straightening a scanned image
PostPosted: Sun Nov 27, 2016 3:16 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
vA+6Q-Hv[BX] wrote:
I do a lot of scanning too. The beds on the affordable scanners are so small, my images are always slanted. :-)

Steps:
1. Click the Measure Tool (so you don't have to eyeball it alone)
2. At the top of your bordered box, draw a line from one side to the other. You may want to zoom in. A quick way to zoom in is to hold the Ctrl key and roll the mouse wheel up and down. In the second video below, he wanted the bridge to be straight. The drawn line will be on an angle.
3. Look at the bottom of Gimp, in the status bar it will show the angle in degrees that you will want to correct.
4. Click the Rotate Tool.
5. Change Direction to Corrective because this ONLY moves the grid which helps you visually see what is going on. I'm not quite sure how Normal is used. It moves both. Show image preview should be checked.
6. Optional Change: Change Clippings to Crop with Aspect, and Number of lines
7. Click the image to display the Rotate Tool's dialog box.
8. Enter the angle value from #3. I entered it in with a negative sign (i.e., -2.18). I then clicked in the text field for "Center X:" so I could see the preview. The grid should have turned and the lines are parallel to your bordered box top (the one you measured). Make any adjustments. Click Rotate.
9. To verify, you can drag down a guideline from the top or measure again.
10. Depending on your Rotation options in #6, you may need to either crop the image or Image > Fit Canvas to Layers


With my ofn-layer-straightener script (see above) it would be:
1. Click the Measure Tool Path tool (so you don't have to eyeball it alone)
2. At the top of your bordered box, draw a line from one side to the other. You may want to zoom in. A quick way to zoom in is to hold the Ctrl key and roll the mouse wheel up and down. In the second video below, he wanted the bridge to be straight. The drawn line will be on an angle.
3. Look at the bottom of Gimp, in the status bar it will show the angle in degrees that you will want to correct.You don't need to read any values
4. Click the Rotate Tool. Not needed
5. Change Direction to Corrective because this ONLY moves the grid which helps you visually see what is going on. I'm not quite sure how Normal is used. It moves both. Show image preview should be checked. Not needed
6. Optional Change: Change Clippings to Crop with Aspect, and Number of lines. Not needed
7. Click the image to display the Rotate Tool's dialog box. Not needed
8. Enter the angle value from #3. I entered it in with a negative sign (i.e., -2.18). I then clicked in the text field for "Center X:" so I could see the preview. The grid should have turned and the lines are parallel to your bordered box top (the one you measured). Make any adjustments. Click Rotate. Just call the script

Additionally, if you "make any adjustments" in step 8 then the initial measurement has no purpose. If you have enough grid lines in the Rotate tool you can set one sufficiently parallel to what you want to straighten.

PS: Your 2nd video is a very bad example. The bridge isn't horizontal due to perspective. Unless you have a real horizon (sea, or very flat country side) there is no horizontal reference in a photo. However, verticals should be vertical. In the video above, he should have made the smokestack vertical....

_________________
Image


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Retexture an image with another image as "Image Pattern" Plug-in

4

No new posts GIMP XCF image plug-in could not open image; File is Not 0 Bytes

4

No new posts Show image on web browser to fill 100% width AND image map

2

No new posts Assembling to look like image while using up tiles from another image.

1

No new posts Attachment(s) image name

2



* Login  



Powered by phpBB3 © phpBB Group