Linux Newbie question

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
Post Reply
TommyW126
Posts: 2
Joined: 2014-06-10T10:02:29-07:00
Authentication code: 6789

Linux Newbie question

Post by TommyW126 » 2014-06-10T10:09:22-07:00

I want to use the unrotate script, but this is what I get. What do I do wrong? Using Linux Mint 17 64bit.

Code: Select all

$ sudo sh unrotate  /home/fuji/Dokumente/Scanverarbeitung/Scans/P1020824.JPG unrotated.jpg
unrotate: 346: unrotate: Syntax error: "(" unexpected (expecting "}")
The unrotate script file is in the same folder as the jpg.

User avatar
fmw42
Posts: 25042
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Linux Newbie question

Post by fmw42 » 2014-06-10T11:02:19-07:00

Please identify your version of Imagemagick and provide if possible the input image. You can upload to dropbox.com (public folder) and put a link here to it.

Is the file you downloaded ending in .sh? If so, you need to either remove the .sh or include .sh in the call to it as unrotate.sh

Did you follow the pointers on my home page? Where is Imagemagick installed? Is it in your $PATH?

To locate where IM is installed, try typing the following in a terminal window.

type -a convert
or
which convert

Does that return anything?

try

bash unrotate /home/fuji/Dokumente/Scanverarbeitung/Scans/P1020824.JPG unrotated.jpg

I have no problem with running my test image. Try testing with one of my examples. If your background is not constant or to remove an antialiasing between the image and background, add -f argument as in my example page. This is especially needed for jpg images that do give pure constant background colors and/or if from a scanner.

Let me know if you can run this from my examples.

bash unrotate zelda3_rotm45.png test_unrotate.png
or
bash unrotate -f 30 zelda3_rotm45.png test_unrotate.png

The image is the example for Rotated -45 deg.

User avatar
fmw42
Posts: 25042
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Linux Newbie question

Post by fmw42 » 2014-06-10T11:07:00-07:00

P.S. For rotations of about 4-5 deg or less, you can try the Imagemagick function -deskew. See http://www.imagemagick.org/script/comma ... php#deskew

TommyW126
Posts: 2
Joined: 2014-06-10T10:02:29-07:00
Authentication code: 6789

Re: Linux Newbie question

Post by TommyW126 » 2014-06-10T23:26:00-07:00

"which convert" shows this: /usr/bin/convert

I am really new to linux, so I do not know how to check if IM is in $PATH or how to add it there. Neither how to check the version of IM.

I tried my file with JqMagick and now I know unrotate is not the tool of choice for my image (trying to align a photographed document so I can run an OCR software and have a .pdf). Propably deskew would be better. Could you tell me what the command line has to look like?

User avatar
fmw42
Posts: 25042
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Linux Newbie question

Post by fmw42 » 2014-06-11T09:26:40-07:00

If unrotate does not help, then -deskew probably will not help, either.

Upload your image to say dropbox.com (public folder) or any free image hosting service and put the URL here. Then I can see what you are trying to do and perhaps offer solution and some IM commands.

The first thing is to get your PHP command to recognize IM.

Try this

<?php
exec("convert -version",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>

If that works, then IM is in your path. If not, then try this


<?php
exec("/usr/bin/convert -version",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>

Let me know what is returned.

P.S. Are you running on your own local computer or on a server hosted by some ISP?

Post Reply