Discussion:
getframe fails
JuanPi
2018-10-06 06:48:30 UTC
Permalink
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.
Pantxo
2018-10-06 07:53:13 UTC
Permalink
Post by 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
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/O
Pantxo
2018-10-06 09:32:48 UTC
Permalink
Post by Pantxo
is part of getframe anyway) and it worked, see bellow. Anyway I can
reproduce this bug. Could you file a bug report?
...
--
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
Juan Pablo Carbajal
2018-10-06 12:29:14 UTC
Permalink
oh, ok, you can close the bug report, then.

Loading...