命令行中的转换命令错误 [英] Error for convert command in command line

查看:55
本文介绍了命令行中的转换命令错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bash shell脚本,如下所示.

I have a bash shell script as below.

#!/bin/bash

SIZES=("512" "1024" "2048")

for i in ${!SIZES[*]}
do
    SIZE=${SIZES[$i]}
    echo $SIZE

    # first, resize original image
    convert -resize $SIZE"x"$SIZE! chernarus2048.jpg chernarus$SIZE"x"$SIZE.jpg
    mkdir tiles$SIZE
    # slice resized image into 256x256 tiles
    convert -crop 256x256 chernarus$SIZE"x"$SIZE.jpg tiles$SIZE/tile%04d.jpg
    rm chernarus$SIZE"x"$SIZE.jpg
done

但是当我使用以下命令在命令行中运行此命令时

But when I run this in command line using the following command

sh generate_tiles.sh chernarus2048.jpg

我遇到错误转换:找不到命令

我正在使用OS X Yosemite 10.10.2.映像保存在放置Shell脚本的文件夹中.请帮帮我.

I'm using OS X Yosemite 10.10.2.The image is kept in the same folder where the shell script is placed. Please help me out.

推荐答案

要遵循的步骤

使用命令安装 $ sudo port install ImageMagick 或使用Homebrew命令 brew install imagemagick 或从链接 http://cactuslab.com/imagemagick/

install using command$ sudo port install ImageMagick or using Homebrew command brew install imagemagick or download from the link http://cactuslab.com/imagemagick/

  • 然后关闭终端并重新启动计算机,然后再次运行代码.

这篇关于命令行中的转换命令错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆