-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect skew angle only (no rotation done) #5
Comments
Original comment by Marek Mauder (Bitbucket: galfar, GitHub: galfar). We must distinguish between these cases:
|
Original comment by Miguel Medalha (Bitbucket: Medalha, GitHub: Medalha). I discovered that images rotated by ImageMagick's "convert" or "mogrify", using the angle provided by Deskew, look a bit sharper than those rotated by Deskew itself, probably due to differences in processing methods (calculating the redistribution of pixels) between the imaging libraries used. This is important because any rotation which is not at 90 degree multiples always somewhat softens the image, degrading it more or less. Obviously, less is preferable. Deskew is specially good at detecting the skew angle of an image. It would be nice being able to get the skew angle provided by Deskew and use it to rotate the image with any other program. To experiment with this, I came up with a "quick and dirty" solution for now. I went to the source file "MainUnit.pas" and made a few modifications which enable me to get as the only output the skew angle, already inverted (multiplication by -1) to provide the rotation needed, not the skew angle itself. This value is then directly passed to "magick mogrify -rotate" as a parameter, through an environment variable. Mogrify rotates the image and rewrites it while respecting the embedded metadata. In my view, Deskew would benefit greatly from being able to satisfy what I suppose are the two main cases: those who want to use all its functionality as is, producing the final images, and those who would like to integrate it in a broader workflow. Relating to what I just exposed (skipping for now other needs such as the type of compression, etc.) I propose the creation of the following new command line switches: -g for "getting" as output only the needed rotation angle (the inverse of the skew angle). -q for "quiet" (Deskew's output is a little bit "chatty" for integration into an automated workflow). Of course these letters are only examples, albeit logic ones (In the case of quiet operation, a log option would also be desirable?). Thank you again. Regards. |
Original comment by Marek Mauder (Bitbucket: galfar, GitHub: galfar). As requested on blog:
Answer:
|
Original comment by Marek Mauder (Bitbucket: galfar, GitHub: galfar).
|
Original comment by Miguel Medalha (Bitbucket: Medalha, GitHub: Medalha). I appreciate your effort in introducing this feature. Nevertheless, as it is it cannot be used to integrate a wider workflow. What would be needed, as I explained above, is a simple output of the rotation angle needed to deskew the image, i.e. in MainUnit.pas remove all output except the following: WriteLn(SkewAngle * -1:4:3); This could be obtained by a new flag under the -g parameter. In this way, the program’s output can be passed to any other program or file, giving your program increased versatility. Thank you again. Miguel |
Original comment by Miguel Medalha (Bitbucket: Medalha, GitHub: Medalha). Here’s an example of a workflow I used with ImageMagick, after doing the aforementioned modification to MainUnit.pas: for /F %%r in ('deskew -g d "%ClientPath%%JobDir%%JobName%-%PageNum%.tif.tmp.tif"') do set Rotation=%%r |
Original report by Marek Mauder (Bitbucket: galfar, GitHub: galfar).
As requested on blog:
Answer:
The text was updated successfully, but these errors were encountered: