Saving a figure in full screen size?

Hello,
I am trying to save a matlab figure in PNG format, I wish to have a full screen size image. I have tried the following two scripts, in both cases the figure is visualized in full screen size, but the PNG file I get is smaller. Could anyone help me to fix this issue?
I thank you in advance. Giuseppe
figure('units','normalized','outerposition',[0 0 1 1])
plot([0,1], [0,1])
print('foos', '-dpng', '-r0');
or
figure; set(gcf, 'Position', get(0, 'Screensize'));
plot([0,1], [0,1])
print('foos', '-dpng', '-r0');

 Respuesta aceptada

Jan
Jan el 16 de Mayo de 2017
FigH = figure('Position', get(0, 'Screensize'));
F = getframe(FigH);
imwrite(F.cdata, 'Foos.png', 'png')

4 comentarios

Giuseppe Papari
Giuseppe Papari el 16 de Mayo de 2017
Thank you so much, now it works!!!
BTW, what was wrong in the code I made?
Jan
Jan el 16 de Mayo de 2017
print does not use the screen resolution and position, but the PaperSize, PaperUnits and PaperPosition properties of the figure, because it is intentionally thought for printing on paper.
Mustafa Vardaroglu
Mustafa Vardaroglu el 10 de Dic. de 2019
Thanks a lot!
Surama Biswas
Surama Biswas el 10 de Mzo. de 2021
How about if i want to save the image after imwrite?

Iniciar sesión para comentar.

Más respuestas (1)

Sarwan ali
Sarwan ali el 24 de En. de 2019
To extend the answer from Jan, you can also use "saveas" command instead of imwrite
FigH = figure('Position', get(0, 'Screensize'));
saveas(FigH, 'Foos.png','png');

Categorías

Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 16 de Mayo de 2017

Comentada:

el 10 de Mzo. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by