moving on slightly from getting LC to process images, I thought I’d try using ImageMagick. I’ve downloaded and put it on my Mac, and tested it, and it works fine (I’m using covert to apply a blur to an image). However, LiveCode really doesn’t like it.
Code: Select all
put appTemporaryFolder & "/dummy.png" into temporaryFile
put image "image" of group "my group" into url ("binfile:" & temporaryFile)
set the defaultFolder to appTemporaryFolder
put "~/ImageMagick-6.9.3/bin/convert" into myCommand
put myCommand && "dummy.png" into myCommand
put myCommand && "-radial-blur 20" into myCommand
put myCommand && "dummy.png" into myCommand
put shell(myCommand)
If I use this to call the convert tool:dyld: Library not loaded: /ImageMagick-6.9.3/lib/libMagickCore-6.Q16.2.dylib
Referenced from: /Users/paul/ImageMagick-6.9.3/bin/convert
Reason: image not found
/bin/sh: line 1: 23110 Trace/BPT trap: 5 ~/ImageMagick-6.9.3/bin/convert dummy.png -radial-blur 20 dummy.png
Code: Select all
put appTemporaryFolder & "/dummy.png" into temporaryFile
put image "image" of group "my group" into url ("binfile:" & temporaryFile)
set the defaultFolder to appTemporaryFolder
put "convert" into myCommand
put myCommand && "dummy.png" into myCommand
put myCommand && "-radial-blur 20" into myCommand
put myCommand && "dummy.png" into myCommand
put shell(myCommand)
So, providing the path to the convert command fails because it seems that an environment variable is not read: dyld: Library not loaded: /ImageMagick-6.9.3/lib/libMagickCore-6.Q16.2.dylib seems to be missing the path to the folder. I expect “convert” isn’t working in the second example because the environment variables are not seen. These were set as per instructions on the ImageMagick page here: http://www.imagemagick.org/script/binary-releases.php (I’m using the Mac OSX Binary release), and if I use Terminal to show them, they are there./bin/sh: line 1: convert: command not found
I am thinking ahead. If I release my application into the wild, this will kill it. I can guarantee that this will throw people, so I’ll want to bundle ImageMagick with the application - which means including using Stand alone Application Settings...>Copy Files and then calling the scripts included in the folder copied with (or in - if you are a Mac person) the application. I’ve done this wth another app, and it’s quite successful (people using command line tools without realising it!), so I’m looking at doing the same with this.
I did try this kind of thing to see if I can get the path to stick, but no luck:
Code: Select all
put tPath & "/Support/includes/Mac/ImageMagick" into imageMagick
put "export MAGICK_HOME=" & quote & imageMagick & quote into myCommand
So, how do I get this working? I’ve been looking for ImageMagick in LiveCode instructions, and while I have seen that some people have managed to get it working, I’ve not been able to find out how - usually its seems that any query involving IM seems to follow getting it working successfully in LC. Thanks.