Automatic rotation

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, helmut, xnview

User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Automatic rotation

Post by Ty »

Any time one scans pictures, a very big problem is alignment/rotation. It is very difficult to get the photos in the scanner to be perfectly aligned, therefore it is necessary to use XnView's "Rotate" capabilities to adjust the image by one or two degrees, or perhaps less. If one does a lot of scanning of photos using a flatbed scanner, getting the photos properly aligned is the biggest time-requirement of the entire process. Or at least it is for me.

My idea/suggestion is to figure out a way to automatically align images. You already have "deskew" for b&w images, but (a) it doesn't work all that well, in my experience, and (b) it's not available for color images. Automatically aligning images must be quite difficult, since I don't recall having ever seen such a feature in any imaging software.

Perhaps it could be accomplished with a function that tells the user "draw a box around one complete edge of the photo", or something, to help XnView figure out what should be the alignment reference. Or perhaps even a single mouse-click to identify an edge.

If such a feature could be built, it would make very big time savings for people who scan photos.
Dreamer
XnThusiast
Posts: 4608
Joined: Sun Jul 25, 2004 9:08 pm

Re: Automatic rotatation

Post by Dreamer »

Automatically aligning images must be quite difficult, since I don't recall having ever seen such a feature in any imaging software.
I don't know any image viewer with dual pane file manager either, but I don't think because it's too difficult to create, authors just don't think it would be useful... Too OT, sorry.

I like this idea - even fully-automatically detect and rotate even multiple images!! I don't think it's impossible, because background color is white - and if images are photographs then they have clear edges. So if this would be possible, I have additional feature request then:

- Automatically save all images (photographs) as multiple image files.

I like any intelligent / automatic features which help user and save time.
Dreamer
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Automatic rotatation

Post by Ty »

Thank you, XnTriq, good reading.

However, we still don't have a solution, as far as I can tell.

It is possible to do a pretty good job of straightening an image--but it is slow, inefficient, and approximate. Better would be a one-click "straighten" function that finds an edge, automatically aligns it to 90 or 180 degrees, "autocrops," and is done. If this process requires help from the user ("draw a line"), then okay. But having to rotate the image by tenths of a degree--one more, one more, one more--is not so good.

If it is possible to detect an edge, then the image can be automatically straightened. If it is not possible to detect an edge on this image, then a message says "This image cannot be automatically straightened. Use Rotate function."
User avatar
XnTriq
Moderator & Librarian
Posts: 6374
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Automatic rotatation

Post by XnTriq »

Hello Ty :-)
Ty wrote:However, we still don't have a solution, as far as I can tell.
These cross-references are intended to illustrate the popularity of such a feature and to emphasize the importance of your request.
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Automatic rotatation

Post by Ty »

Thanks, XnTriq. I wasn't quite sure what your earlier message was suggesting, but it makes sense now.
User avatar
rra
Posts: 192
Joined: Thu May 11, 2006 1:46 pm
Location: The Netherlands

Re: Automatic rotatation

Post by rra »

I like this idea - even fully-automatically detect and rotate even multiple images!! I don't think it's impossible, because background color is white - and if images are photographs then they have clear edges. So if this would be possible, I have additional feature request then:

- Automatically save all images (photographs) as multiple image files.
Apparently Photoshop CS4 already has such e feature, so it can't be that difficult:

"Crop and Straighten command"
"Scan multiple images at once and let Photoshop automatically straighten and save each image as an individual file."

I have no experience with this feature, maybe someone can tell us how well this works ?

René
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Automatic rotation

Post by Ty »

Rene--

I just heard of the feature you describe from a friend with a Mac, and he wasn't sure of the software--something that came with the computer when he bought it. But it does exactly as you say: allows you to scan multiple images (like photos on a page) with one scan, which would normally make one image, and then the software identifies and separates the master image into 2/3/4/5/6/etc smaller images. A few months ago I saw some HP scanning software that also did this--although it did a very bad job of it. But the concept is very good, and I think would be a welcome addition to XnView--certainly for anybody who scans multiple images per sheet.
User avatar
rra
Posts: 192
Joined: Thu May 11, 2006 1:46 pm
Location: The Netherlands

Re: Automatic rotation

Post by rra »

I still have no experience with this feature from CS4,
If it works like promised it would also be a nice feature for XnView,
although I am already satisfied with an "automatic rotate" feature for only one (scanned) image.

René
User avatar
XnTriq
Moderator & Librarian
Posts: 6374
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Automatic rotation

Post by XnTriq »

Ty wrote:I just heard of the feature you describe from a friend with a Mac, and he wasn't sure of the software--something that came with the computer when he bought it.
If the program was pre-installed, it's most probably Apple iPhoto.
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Automatic rotation

Post by Ty »

XnTriq, you may be right about the tool, but the straightening I was referring to is automatic. The method that XnView uses for manually straightening photos is fine (though Google's and Apple's is perhaps a little easier). But what I'm hoping Pierre will want to add is some AUTOMATIC straightening function: you identify the photo you want straightened and say "go", XnView does the rest. Of course, having a batch mode of the same thing would also be excellent. The point is that manually straightening images is very time-consuming, and we THINK that it can be done automatically (i.e., there are other programs that do it). So if the maestro would consider adding "auto-straighten" (or something) to the "rotation" menu, we would all be very grateful.
User avatar
XnTriq
Moderator & Librarian
Posts: 6374
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Automatic rotation

Post by XnTriq »

Ty wrote:The point is that manually straightening images is very time-consuming, and we THINK that it can be done automatically (i.e., there are other programs that do it).
OK, now I see what you and René are talking about.
It took me awhile to realize that this is actually a built-in “one-click” command in Photoshop and not an action, a script or a plug-in.

I was hoping to find some code samples for automatic de-skewing, but all the open source stuff seems to work with line art or greyscale images only. :|
quantum
Posts: 6
Joined: Thu Sep 10, 2009 1:28 pm

Re: Automatic rotation

Post by quantum »

Gimp has a deskew plugin. It works automatically and very well. For the samples I tried, it works better than Photoshops automatic deskew:
File->Automate-Crop and Straighten

http://www.cubewano.org/gimp-deskew-plugin/
The Gimp deskew plugin author describes the source as using the "Radon" algorithm from the pagetools project (link on the author's site).

I've been using Gimp from the command line for deskew and then calling nconvert for the rest of my processing. It would be great to have deskew included in XnView and NConvert.
quantum
Posts: 6
Joined: Thu Sep 10, 2009 1:28 pm

Re: Automatic rotation

Post by quantum »

ImageMagick also has an automatic deskew feature. I think this program is open source:

http://www.imagemagick.org/script/comma ... php#deskew

I've used this and it works.
User avatar
xnview
Author of XnView
Posts: 44583
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Automatic rotation

Post by xnview »

quantum wrote:ImageMagick also has an automatic deskew feature. I think this program is open source:
http://www.imagemagick.org/script/comma ... php#deskew
I've used this and it works.
Ok, i'll check
Pierre.