Hello,
I'm new to IM, and not a very strong developer. This may sound like a silly question, but I couldn't find any instructions on a simple way to do this. I would like to use this divide_vert script:
http://www.imagemagick.org/Usage/scripts/divide_vert
But I don't know how to install it or where to put it so that I can access it from the command line (bash). I just installed IM last week and I'm using Mac OS X 10.5.6.
Any advice would be very much appreciated.
Thanks,
K
Using scripts from command line on Mac
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using scripts from command line on Mac
You can put it anywhere and just use:
pathtoscript/scriptname arguments pathtoinputimage pathtooutputimage
However you can make it easier.
I am on a mac (OSX Tiger) and have built many scripts (see http://www.fmwconcepts.com/imagemagick/index.html). I learned quite a lot from Anthony Thyssen in the beginning. My procedure now is to keep all my images at the root of my home directory (to avoid the path to the images), but store my scripts at Applications/bin/ImageMagick-Scripts. Then Anthony helped me modify my .profile file (a hidden file in my home directory, but you can use BBEdit to view and edit hidden files if you need some text editor for that). It is modified to include the path to where I keep my scripts. That way I do not have to supply the path to the script.
So my .profile file looks as follows:
##
# DELUXE-USR-LOCAL-BIN-INSERT
# (do not remove this comment)
##
echo $PATH | grep -q -s "/usr/local/bin"
if [ $? -eq 1 ] ; then
PATH=$PATH:/usr/local/bin
export PATH
fi
export PATH="${PATH}:/Users/fred/Applications/ImageMagick-Scripts/bin"
export DISPLAY=:0
I simply edited the default .profile file (after backing it up) by adding the lines:
export PATH="${PATH}:/Users/fred/Applications/ImageMagick-Scripts/bin"
export DISPLAY=:0
The second line seems to be needed on macs so that you can display images, but you need to install X11 (which may come on your install CD, perhaps as part of Xcode Tools, but is probably not installed by default. I don't recall, now). Otherwise you can get it at: http://developer.apple.com/opensource/tools/X11.html
You may want to see my early notes when I first learned to install IM manually. See
viewtopic.php?f=1&t=10442
pathtoscript/scriptname arguments pathtoinputimage pathtooutputimage
However you can make it easier.
I am on a mac (OSX Tiger) and have built many scripts (see http://www.fmwconcepts.com/imagemagick/index.html). I learned quite a lot from Anthony Thyssen in the beginning. My procedure now is to keep all my images at the root of my home directory (to avoid the path to the images), but store my scripts at Applications/bin/ImageMagick-Scripts. Then Anthony helped me modify my .profile file (a hidden file in my home directory, but you can use BBEdit to view and edit hidden files if you need some text editor for that). It is modified to include the path to where I keep my scripts. That way I do not have to supply the path to the script.
So my .profile file looks as follows:
##
# DELUXE-USR-LOCAL-BIN-INSERT
# (do not remove this comment)
##
echo $PATH | grep -q -s "/usr/local/bin"
if [ $? -eq 1 ] ; then
PATH=$PATH:/usr/local/bin
export PATH
fi
export PATH="${PATH}:/Users/fred/Applications/ImageMagick-Scripts/bin"
export DISPLAY=:0
I simply edited the default .profile file (after backing it up) by adding the lines:
export PATH="${PATH}:/Users/fred/Applications/ImageMagick-Scripts/bin"
export DISPLAY=:0
The second line seems to be needed on macs so that you can display images, but you need to install X11 (which may come on your install CD, perhaps as part of Xcode Tools, but is probably not installed by default. I don't recall, now). Otherwise you can get it at: http://developer.apple.com/opensource/tools/X11.html
You may want to see my early notes when I first learned to install IM manually. See
viewtopic.php?f=1&t=10442
Re: Using scripts from command line on Mac
Thank you for your reply - this is most helpful. One of the other scripts that I wanted to play with was the variableblur script that I found on your site.
I'm really a novice with this stuff...right now at the command line I see:
my-macbook-air:~KKD$
I can invoke IM by typing:
my-macbook-air:~KKD$ convert
I put the variableblur file in this KKD directory. Assuming my input and output images (i.e. blur-in.jpg and blur-out.jpg) will be in this same directory, could you give me an example of exactly what to type to invoke this file? I'm assuming it would follow the structure of this below example that you gave me:
pathtoscript/scriptname arguments pathtoinputimage pathtooutputimage
Thanks again,
K
I'm really a novice with this stuff...right now at the command line I see:
my-macbook-air:~KKD$
I can invoke IM by typing:
my-macbook-air:~KKD$ convert
I put the variableblur file in this KKD directory. Assuming my input and output images (i.e. blur-in.jpg and blur-out.jpg) will be in this same directory, could you give me an example of exactly what to type to invoke this file? I'm assuming it would follow the structure of this below example that you gave me:
pathtoscript/scriptname arguments pathtoinputimage pathtooutputimage
Thanks again,
K
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using scripts from command line on Mac
If my-macbook-air:~KKD is your home directory (which it looks like to me as mine is freds-mac-mini:~ fred), then just type after the $ prompt:
variableblur arguments inputimage maskimage outputimage
(my-macbook-air:~KKD$variableblur arguments inputimage maskimage outputimage)
see examples at http://www.fmwconcepts.com/imagemagick/ ... /index.php for the arguments and mask image that is needed.
First check the downloaded version of your script and see if it has a suffix, such as .sh or .bash. If it does, then you need to either remove it or add that to the above as
variableblur.sh arguments inputimage maskimage outputimage
If my-macbook-air:~KKD is not your home directory, try cd (change directory) to KKD directory and then run the above. Alternately, from your home directory add the path to KKD
pathtoKKD/variableblur arguments pathtoKKD/inputimage pathtoKKD/maskimage pathtoKKD/outputimage
Let me know how that works.
variableblur arguments inputimage maskimage outputimage
(my-macbook-air:~KKD$variableblur arguments inputimage maskimage outputimage)
see examples at http://www.fmwconcepts.com/imagemagick/ ... /index.php for the arguments and mask image that is needed.
First check the downloaded version of your script and see if it has a suffix, such as .sh or .bash. If it does, then you need to either remove it or add that to the above as
variableblur.sh arguments inputimage maskimage outputimage
If my-macbook-air:~KKD is not your home directory, try cd (change directory) to KKD directory and then run the above. Alternately, from your home directory add the path to KKD
pathtoKKD/variableblur arguments pathtoKKD/inputimage pathtoKKD/maskimage pathtoKKD/outputimage
Let me know how that works.
Re: Using scripts from command line on Mac
Thanks again for the help on this
Right now I've got the file called variableblur.sh in a dir called 'scripts' in my home directory (KKD).
This is what I'm putting in and getting out of the command line:
my-macbook-air:~ KKD$ scripts/variableblur.sh -help
-bash: scripts/variableblur.sh: Permission denied
Any ideas what I might be doing wrong?
Right now I've got the file called variableblur.sh in a dir called 'scripts' in my home directory (KKD).
This is what I'm putting in and getting out of the command line:
my-macbook-air:~ KKD$ scripts/variableblur.sh -help
-bash: scripts/variableblur.sh: Permission denied
Any ideas what I might be doing wrong?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using scripts from command line on Mac
magickusernyc wrote: my-macbook-air:~ KKD$ scripts/variableblur.sh -help
-bash: scripts/variableblur.sh: Permission denied
Any ideas what I might be doing wrong?
Yes, that is typical when downloading a file. The permission get changed. Do a cd to your scripts directory and then type:
chmod u+x variableblur.sh
That will add the permission to execute the script .
If you then type:
ls -al
it will list all the files in that directory and you should have:
-rwxr--r-- 1 fred fred 6665 Jun 4 2008 variableblur
That is the line should start with -rwxr--r-- permission. It needed to start with -rwx, in particular, it needed to add the x (for executable)