简体   繁体   中英

imagemagick error when run from bash script on Mac OSX

I want to run the following script in bash 3.2.57(1):

#!/bin/bash
basename=abc
convert  $basename.pdf $basename.png

I get the following error:

dyld: Library not loaded: /ImageMagick-7.0.8/lib/libMagickCore-7.Q16HDRI.6.dylib
  Referenced from: /Users/XXX/Applications/ImageMagick-7.0.8/bin/convert
  Reason: image not found
./batch_convert.sh: line 22: 46228 Abort trap: 6           convert $basename.pdf $basename.png

When I run the same 2 commands (setting the variable and convert ), I get no error.

Why is this happening?

Using IM 7.0.8.59 Q16 Mac OSX Sierra, this works for me.

create a pdf

magick logo: logo.pdf


create a script called test.sh

#!/bin/bash

xxx="logo"
magick $xxx.pdf $xxx.png


run script by typing its name in a bash terminal

bash test.sh


在此处输入图片说明

Try that and report if that works. I was working from my desktop. So the script and pdf file were on my desktop.

Note that logo: (with the colon) is an ImageMagick internal image. So it is available from anywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM