The Background Color Is Not Saved!
37 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Rightia Rollmann
il 13 Ago 2017
Modificato: Image Analyst
il 31 Mar 2022
I want to save this image with a gray background, but when I open the .jpg file, it appears with a white background.
h = gcf;
ax = gca;
ax.Color = [0.5 0.5 0.5];
saveas(h, 'image.jpg');
What is the solution to save the background color to the image file as well?
0 Commenti
Risposta accettata
Image Analyst
il 14 Ago 2017
Modificato: Image Analyst
il 31 Mar 2022
Try getframe().
Starting with r2020b you can use exportgraphics():
exportgraphics(gca, fileName);
It should look just like it looks on screen.
0 Commenti
Più risposte (1)
Navid Ghajarnia
il 31 Mar 2022
The answer to this questionis given here:
Please execute the following command before you save the figure in the PNG format.
set(gcf, 'InvertHardcopy', 'off');
Then, you can save the plot as it is displayed.
0 Commenti
Vedere anche
Categorie
Scopri di più su Printing and Saving in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!