在Octave中从图形创建动画时出错

时间:2019-03-26 11:34:30

标签: octave

我正在尝试从图形制作动画并将结果另存为gif或视频。 该图形和动画在matlab中效果很好,但是我无法将其另存为gif。

'imread'给出错误:

Magick: "gswin32c" "-q" "-dBATCH" "-dSAFER" "-dMaxBitmap=50000000" "- 
dNOPAUSE" "-sDEVICE=ppmraw" "-dTextAlphaBits=4" "-dG
raphicsAlphaBits=4" "-r72x72" "-dFirstPage=1" "-dLastPage=1" "- 
sOutputFile=C:\Users ...

我尝试了here的解决方案,但该错误弹出。

这是我的代码:

clear all;
clc;

for m = 1:10
  n = m.*100;

  x  = linspace(0,1500,1500);
  x2 = linspace(n,1000+n,500);

  y2 = [((20e-6.*n + 0.008).*(sin(pi/1000.*(x2-n))).^2) ];

  y1 = zeros(1,n);
  y3 = zeros(1,1000-n);
  y7 = [y1 y2 y3];
  y8 = y7 + 0;

  y1 = (sin(pi/150*x)).^2;
  y3 = exp((x/400)-5);

  y5 = (y1.*y3)+y8;

  plot( x,y5);
  drawnow;
  #pause(0.01);
endfor


im = imread ("animation.pdf", "Index", "all");
imwrite (im, "animation.gif", "DelayTime", .5);

编辑: 这是完全错误。目录地址已编辑。

    Magick: "gswin32c" "-q" "-dBATCH" "-dSAFER" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw"
"-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r72x72" "-dFirstPage=1" "-dLastPage=1" "-sOutputFil
e=C:\Users\XXXXXXXXXXXXXXXXXXXXXXXXXX" "--" "C:\Users\XXXXXXXXXXXXXXXXXXXXXXXXXX" "-c
" "quit" [No such file or directory].
error: Magick++ exception: Magick: Postscript delegate failed (F:\XXXXXXXXXXXXXXXXXXXXXXXXXX\animation.pdf) reported by coders/pdf.c:434 (ReadPDFImage)
error: called from
    __imread__ at line 78 column 10
    imageIO at line 118 column 26
    imread at line 106 column 30
    test_animation2 at line 6 column 4

1 个答案:

答案 0 :(得分:0)

我有同样的问题。

对我来说,解决方案是安装或重新安装GhostScript program

这是我收到的错误消息:

Magick: "gswin32c" "-q" "-dBATCH" "-dSAFER" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw"
"-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r72x72" "-dFirstPage=1" "-dLastPage=1" "-sOutputFil
e=C:\Users\xxxxxx\AppData\Local\Temp\gmncleNd" "--" "C:\Users\xxxxxx\AppData\Local\Temp\gmEh1Xv4" "
-c" "quit" [No such file or directory].
error: Magick++ exception: Magick: Postscript delegate failed (C:\Users\xxxxxx\Desktop\TexML2.0\IN
entrada\in.pdf) reported by coders/pdf.c:434 (ReadPDFImage)
error: called from
    _imread_ at line 80 column 10
    imageIO at line 118 column 28
    imread at line 106 column 33