getframe fails

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

getframe fails

JuanPi
Hi all,

The following code

n = 10000;
for i=1:4
    figure(i)
    plot (randn(n,1), randn(n,1), '.')
endfor

for i=1:4
    figure(i)
    set (gcf, 'units', 'normalized', 'position', [0 0 0.9 0.9]);
    drawnow
    imwrite (frame2im (getframe (gcf)), sprintf("/tmp/tstfig-%d.png", i));
endfor

gives

warning: called from
    getframe at line 102 column 11
warning: opengl_renderer: Error 'invalid value' (1281) occurred
drawing 'text' object

and the images are empty.

Any work around? Note that I need getframe because printing to file
takes forever (opengl or gnuplot))

--
JuanPi Carbajal
https://goo.gl/ayiJzi

-----
“An article about computational result is advertising, not
scholarship. The actual scholarship is the full software environment,
code and data, that produced  the  result.”
- Buckheit and Donoho


Reply | Threaded
Open this post in threaded view
|

Re: getframe fails

Pantxo
JuanPi wrote

> Hi all,
>
> The following code
>
> n = 10000;
> for i=1:4
>     figure(i)
>     plot (randn(n,1), randn(n,1), '.')
> endfor
>
> for i=1:4
>     figure(i)
>     set (gcf, 'units', 'normalized', 'position', [0 0 0.9 0.9]);
>     drawnow
>     imwrite (frame2im (getframe (gcf)), sprintf("/tmp/tstfig-%d.png", i));
> endfor
>
> gives
>
> warning: called from
>     getframe at line 102 column 11
> warning: opengl_renderer: Error 'invalid value' (1281) occurred
> drawing 'text' object
>
> and the images are empty.
>
> Any work around? Note that I need getframe because printing to file
> takes forever (opengl or gnuplot))
>
> --
> JuanPi Carbajal
> https://goo.gl/ayiJzi
>
> -----
> “An article about computational result is advertising, not
> scholarship. The actual scholarship is the full software environment,
> code and data, that produced  the  result.”
> - Buckheit and Donoho

Hi,

I tried to set figure "units" back to "pixels" and remove "drawnow" (which
is part of getframe anyway) and it worked, see bellow. Anyway I can
reproduce this bug. Could you file a bug report?
...
for i=1:4
    figure(i)
    set (gcf, 'units', 'normalized', 'position', [0 0 0.9 0.9], 'units',
'pixels');
    imwrite (frame2im (getframe (gcf)), sprintf("/tmp/tstfig-%d.png", i));
endfor


Pantxo



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: getframe fails

Pantxo
Pantxo wrote
> is part of getframe anyway) and it worked, see bellow. Anyway I can
> reproduce this bug. Could you file a bug report?
> ...
>
> --
> Sent from:
> http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

Never mind, I pushed a simple fix here:

http://hg.savannah.gnu.org/hgweb/octave/rev/bb9fcc452580

Pantxo



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: getframe fails

Juan Pablo Carbajal-2
oh, ok, you can close the bug report, then.