Whenever I export a figure in matlab to a png or jpg, the background is always gray. This is the case with using the 'print' and 'saveas' functions, as well as the fileexchange function export_fig. I have tried toggling the inverthardcopy and color figure settings to no avail.
This is very strange because it is a recent problem that seems to come out of nowhere. That is, i had no problems one day on my machine and the next day the same code could not switch the background color (white is what i want). In fact, exporting figures on my home computer works exactly as expected.
For example, the following code will save a figure with a gray background on my laptop but a white background on my home computer.
>> a = rand(100,2); >> plot(a); >> set(gcf,'inverthardcopy','off'); >> set(gcf,'color','w'); >> saveas(gcf,'test.png');
Similarly, if i set inverthardcopy to 'on' and dont change the background color, my home computer png will have a white background and my laptop will have a gray one.
I have noticed that the only way i can get the correct background color on a saved image is by setting inverthardcopy to 'off', manually changing the figure color, and saving as a .bmp file.
Any ideas on what setting may have been changed on my laptop to cause this?