OT: Command-line blues (ImageMagick)

Graham Samuel livfoss at mac.com
Fri Oct 28 07:33:33 CDT 2011


Some people may remember my on-off quest for a way of handling PDFs in LiveCode. What I want to be able to do is to let my geography-teacher users (on Windows) read PDF-formatted bitmaps into LiveCode and do stuff with them. I also want to do the same thing with TIFFs. After loads of discussion - some technical, and some about licensing issues - I decided to use ImageMagick (IM), a comprehensive and free (kind of) conversion and graphic manipulation package. Sadly it has a command-line interface which I need to learn and then to get my app to access via shell.

Although I'm eventually developing a Windows app, I decided to use the Mac version of IM to experiment with, since that's my normal development environment. The installation was tough (see the note at the end of this mail) but I've got there now. 

The thing is, I don't understand the basic grammar of the command-line, and I need some help. I'm not talking about the fine detail of IM's commands (there's tons of info on that) but stuff like:

1. How do I invoke a program from the command line? In the tests I did as suggested on the IM site, I typed for example

   convert logo: logo.gif

without (AFAICS) invoking IM first, or telling the program the path to the graphic it had to work on. How does this work? Surely other programs within the machine have or might have functions like 'convert'. How to I know that the command is going to be taken up by the right program (IM)?

2. How do I get and send files from/to ordinary destinations in my machine? I assume that the reference to 'logo.gif' in the example because the context (aka default file path) was somehow already set. Do I just have to refer to my actual files using standard (Unix style) file paths? Are there tricks I should know?

3. How do I dismiss a program when I don't want it any more (I mean how do I quit)? Is there a standard way of doing this, or does a program invoked with the command line just dismiss itself? If not, isn't it using up RAM and other resources in my machine?

I realise that these are very very naive questions, but the last time I used a command line interface for any serious task was before most members of this list were born, and things have changed since then (haven't they?). Rather than answering me directly, perhaps some kind person can point me to a primer which will make all this clear. Of course I'd also be interested in differences between PCs and Macs in this respect - I find the degree of unanimity that I've seen so far quite peculiar, actually.

TIA

Graham

[As an aside I would NOT recommend IM on a Mac to anyone who has only worked within a GUI environment. The installation of IM for Mac took longer (and appeared to use more resources) than installing Lion on my Mac, even if you take into account my making a complete clone of my hard disk before the Lion installation started. My machine is now stuffed with Xcode, MacPorts, countless components of IM, and IM itself. If there is an uninstall process I have not discovered it and probably never will. So, IMHO, avoid. In contrast, there is a simple .exe file available for the PC. No geography teacher would ever be willing to do the Mac install, although doubtless many of them are very able, so there will never be a Mac version of my app.]



More information about the use-livecode mailing list