필터 지우기
필터 지우기

The Background Color Is Not Saved!

조회 수: 42 (최근 30일)
Rightia Rollmann
Rightia Rollmann 2017년 8월 13일
편집: Image Analyst 2022년 3월 31일
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?

채택된 답변

Image Analyst
Image Analyst 2017년 8월 14일
편집: Image Analyst 2022년 3월 31일
Try getframe().
Starting with r2020b you can use exportgraphics():
exportgraphics(gca, fileName);
It should look just like it looks on screen.

추가 답변 (1개)

Navid Ghajarnia
Navid Ghajarnia 2022년 3월 31일
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.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by