Unwanted figure transparency in Windows 7

1 回表示 (過去 30 日間)
Simon
Simon 2012 年 11 月 28 日
I am generating and saving lots of plots with the following saving method:
set(gcf,'Color','w')
I = getframe(gcf);
imwrite(I.cdata, [printname,'.jpg']);
Most of the graphs are opaque but some are semi-transparent. I think this has happened since switching to Windows 7 from XP. How can I stop them becoming transparent?

回答 (2 件)

Matt Fig
Matt Fig 2012 年 11 月 28 日
It might help if you set the renderer to zbuffers.
set(gcf,'render','zbuffers')
But if you have any transparent graphics objects this will destroy the transparency of those objects.
  1 件のコメント
Simon
Simon 2012 年 11 月 28 日
Great, that works, thanks.

サインインしてコメントする。


Jan
Jan 2012 年 11 月 28 日
編集済み: Jan 2012 年 11 月 28 日
It is not Windows 7 but the responsibility of Java for rendering the figures. This problem can be fixed by inserting a pause(0.02) before getframe(). Unfortunately this is not documented. drawnow should do this also according to the documentation, but it is not enough to let Java process its event dispatch thread. If 0.02 seconds are enough even under extrem system load is not known. Therefore I check the picture manually for "dropouts" afterwards. For the creation of a 30 minute animation movie this is hilariously silly.
@TMW: The collaboration between getframe, drawnow and Java is suboptimal, to say it friendly.

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by