问题:利用GMT绘制生成了eps格式的图像,为了将图像插入到word中,且保持较高的分辨率,利用convert进行图像格式转换,将eps转换成tiff格式。

 code:


for i in *.ps
do
echo $i
name=`basename $i .ps`
convert $i ${name}.tiff
done

 出现错误:

tran.sh: line 2: syntax error near unexpected token `$'do\r''
'ran.sh: line 2: `do
解决方法:

错误原因是代码是在windows环境下编写,而cygwin bash shell只能处理unix格式,因此需要进行转换

 方法一:dos2unix filename

方法二:在notepad++下编辑->档案格式转换中进行格式转换

 

格式转换的图像出现下面问题:

convert图像格式批量转换

解决方法:

 在convert命令中加入depth控制参数,代码如下:

for i in *.ps
do
echo $i
name=`basename $i .ps`
convert -depth 8 $i ${name}.tiff
done

 结果如下:

convert图像格式批量转换

 

相关文章:

  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-10-13
猜你喜欢
  • 2021-11-17
  • 2021-11-17
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-04-20
相关资源
相似解决方案