Fred's ImageMagick Scripts

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
codespiderindia
Posts: 4
Joined: 2013-04-18T23:23:05-07:00
Authentication code: 6789

Fred's ImageMagick Scripts

Post by codespiderindia »

Hi,

I am very new to imageMagick, i have prepared script using GD library but i want to go with imageMagick now.
But i am having trouble preparing installation environment, i am using wamp on local machine and have a linux shared hosting.

How can i have imageMagick configured with texteffect script on my local machine and on server too.
I am very much interested in having my script prepared with imageMagick.

Pls help.

If possible pls mail me guidelines at manojgorasya[at]gmail.com

Thanks In Advance,
Codespider
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Fred's ImageMagick Scripts

Post by anthony »

New topic for split from the "announce" to the users section (due to report)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Fred's ImageMagick Scripts

Post by Bonzo »

The scripts should work OK on your server as it is Linux based.

The problem you have with your local setup is that certain functions are not available on Windows. You may be able to get them to work if you installed cygwin; I could not be bothered to do this and so to try Freds scripts I upload them onto the server.
codespiderindia
Posts: 4
Joined: 2013-04-18T23:23:05-07:00
Authentication code: 6789

Re: Fred's ImageMagick Scripts

Post by codespiderindia »

@ Bonzo

I have checked the the server's php environment and found imageMagick is already installed there,
now i want to use texteffect scripts, how can i have this functions available?

I know you can help me with.

Will i have to contact my server administrator for the same?

Waiting for your response.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Fred's ImageMagick Scripts

Post by Bonzo »

This is how I run the shell scripts on my server ( this is using the autotrim script but the method is basicaly the same ):

Code: Select all

Download the script and upload it to your server.
Change the permissions to 755 on the script
Write your php code like this using the full path to the script

<?php 
// Run the script 
exec("/FULL PATH TO AUTOTRIM/autotrim input.png output.png 2>&1", $array); 
 //Display any errors 
echo "<br>".print_r($array)."<br>";  
echo "</pre>"; 
?>
This should display any errors you may get.
codespiderindia
Posts: 4
Joined: 2013-04-18T23:23:05-07:00
Authentication code: 6789

Re: Fred's ImageMagick Scripts

Post by codespiderindia »

Thank you Bonzo!

I have got it working on my server.


:)
codespiderindia
Posts: 4
Joined: 2013-04-18T23:23:05-07:00
Authentication code: 6789

Re: Fred's ImageMagick Scripts

Post by codespiderindia »

@Bonzo,

I am able to use the texteffect script, but some of the effects are not working listed below -

wedge-left
wedge-top-left
wedge-bottom-left
wedge-right-text
wedge-top-right-text
wedge-bottom-right

I think they should work as script is working fine for rest of other effect. I am happy to have this script working.

Can you help me with this?

Thanks,
Codespiderindia
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Fred's ImageMagick Scripts

Post by Bonzo »

The normal shadow bevel etc. are working OK for me but anything with a distort is failing.

I will contact Fred and get him to look into it.

Version: ImageMagick 6.7.6-6 2012-04-22 Q16
Last edited by Bonzo on 2013-04-23T10:15:02-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fred's ImageMagick Scripts

Post by fmw42 »

What version of IM are you using and on what platform? What is the web site?

There may be specific issues with IM bugs at your release. Is it failing for the current version of IM 6.8.4.10 or for any version after 6.7.8.3. If you have too old a version of IM then certain -distort functions either were not around or used different control point syntax for SRT and Perspective.

Further clarification of your environment is needed with explicit command lines to test against before I can look into it properly. In the mean time

texteffect -t "SOME WEDGETOPLEFT TEXT" -s outline -e wedge-top-left -d 0.5 -f Arial -p 48 -c skyblue -b white -o black -l 1 -u lightpink 1test_texteffect.png

works fine for me in IM 6.8.4.10 and 6.7.8.3 AND 6.7.6.6 on my Mac OSX Snow Leopard system
creekpeanut
Posts: 25
Joined: 2012-08-14T09:36:42-07:00
Authentication code: 67789

Re: Fred's ImageMagick Scripts

Post by creekpeanut »

Dont know if this is the right place.

When I try to run the script 3Dcover.

sh 3Dcover -s "25%" -a 25 a.jpg b.jpg

I get the following message.

dirname: missing operand

I am running in the cygwin cmd window.

Thank you can help me with this error.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fred's ImageMagick Scripts

Post by fmw42 »

creekpeanut wrote:Dont know if this is the right place.

When I try to run the script 3Dcover.

sh 3Dcover -s "25%" -a 25 a.jpg b.jpg

I get the following message.

dirname: missing operand

I am running in the cygwin cmd window.

Thank you can help me with this error.
The script should still work. That is a problem in that I have used a unix command in the script that expects to know where the script resides via your PATH. It should not affect the result. To fix it, add the path to where you keep your 3Dcover script into your PATH. You can edit your .profile file or just insert that in the scripts in a similar way to how you I specified in my Pointers on my web site how to put the path to IM convert in the PATH. See http://www.fmwconcepts.com/imagemagick/index.php. Put those commands just under the comments at the top of the script and above where the defaults are set. Something like.

imdir="path to where IM convert resides" # typically /usr/bin or /usr/local/bin
PATH="${imdir}:${PATH}"

scriptpath="path to where you have placed your scripts"
PATH="${PATH}:${scriptpath}"

Or add the following in your .profile

export PATH="${PATH}:path to where you have placed your scripts"
creekpeanut
Posts: 25
Joined: 2012-08-14T09:36:42-07:00
Authentication code: 67789

Re: Fred's ImageMagick Scripts

Post by creekpeanut »

I think I am almost there..

Here is a my cmd

$ sh /cygdrive/c/cygwin/home/testbox/3Dcover a.jpg b.jpg

Here is the error I am getting.
")syntax error: invalid arithmetic operator (error token is "

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

Re: Fred's ImageMagick Scripts

Post by fmw42 »

Are you using the latest version of the script? It was just updated to fix some issue a few days ago? If it still fails for you, then provide the image you are trying to use and I will test it or use the image I used on my web site. I cannot tell anything from that message unless there are further details such as a line number.

This works fine for me under IM 6.8.5.6 Q16 Mac OSX Snow Leopard.

3Dcover wedding.jpg show:

What version of IM are you using?
creekpeanut
Posts: 25
Joined: 2012-08-14T09:36:42-07:00
Authentication code: 67789

Re: Fred's ImageMagick Scripts

Post by creekpeanut »

Ok so I downloaded the wedding.jpg image and I am still getting the error.

It does not show a line number where the error is coming from.
testbox@printdemo ~
$ sh /cygdrive/c/cygwin/home/textbox/3Dcover wedding.jpg show:
")syntax error: invalid arithmetic operator (error token is "
The error gives no line number.

here is a link to the 3Dcover file I am using.

http://pastebin.com/yPZmuz7t

IM version: 6.8.5-Q16 cygwin for Windows 7
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fred's ImageMagick Scripts

Post by fmw42 »

This probably won't matter, but it is generally best to replace

# set directory for temporary files
dir="." # suggestions are dir="." or dir="/tmp"

with

dir="/tmp" # suggestions are dir="." or dir="/tmp"


The only other thing I can suggest is that you put in echo statements at various places in the script and see if you can pin down where the error message is coming from.

e.g

echo "1"
...
echo "2"
...
echo "3"


where ... is my code. So keep placing them until you can pinpoint what line or group of lines is causing the error message.

It may be a problem with your Cygwin and perhaps needing some other unix command. Often bc is missing an needs to be added. But that usually gives an error message that bc is missing.
Post Reply