OpenGL and print
显示 更早的评论
I've searched the blogs and answers but haven't found a satisfactory answer except that there is no satisfactory answer... so i'll ask here just to check. I am running R2011a 64bit Ubuntu O/S, fyi.
I am making a figure that uses transparency and was using jbfill from the file exchange. The script is great and produces a nice looking screen figure. However, when I print the figure to a file using print('-dpsc2','-r300','example.ps'), the ps file is total junk when using transparency<1 (in jbfill) and the ps file is fine when transparency is off (=1 in jbfill). seems like OpenGL is the problem. Is there any additional settings I can use to successfully print a figure with transparency (ie. with OpenGL) to a postscript or other file type? here's a sample script based on something in jbfill.m:
a=rand(1,20);
b=a+2*rand(1,20);
x=1:20;
% no transparency, ps file is fine
figure(1)
[ph,msg]=jbfill(x,a,b,'b','b',0,1);
print('-dpsc2','-r300','example1.ps');
% transparency, ps file is total junk
figure(2)
[ph,msg]=jbfill(x,a,b,'b','b',0,0.5);
print('-dpsc2','-r300','example2.ps');
1 个评论
Oliver Woodford
2011-12-24
I would rename the question "Exporting figures with transparency as vector graphics" as it is more informative.
回答(6 个)
Walter Roberson
2011-12-20
0 个投票
Transparency like you would like to use is not supported by Postscript. See http://en.wikipedia.org/wiki/Transparency_%28graphic%29#Transparency_in_PostScript
Meanwhile, have you tried Oliver's FEX contribution export_fig ?
Brian
2011-12-20
0 个投票
1 个评论
Walter Roberson
2011-12-20
The only known issue I see on that page is that transparency is not supported for the painters renderer. It isn't supported for zbuffer either but the page doesn't mention that. The portion of the page describing the -transparency flag indicates that you can use full blended transparency if you are exporting to PNG files (using OpenGL renderer)
Brian
2011-12-21
7 个评论
Walter Roberson
2011-12-21
Hmmm, just now on R2008b on Ubuntu 10.04, I simply used
logo;
alpha(0.5)
print -dpng -r300 /tmp/testimg.png
The resulting file /tmp/testimg.png looks like it has transparency. I did not try to composite it with other images though.
logo;alpha(0.5) is the example Oliver uses of saving images with transparency to PNG files.
Brian
2011-12-21
Walter Roberson
2011-12-21
Odd, looks fine when I try it. See http://img834.imageshack.us/img834/3577/testimgc.png
Walter Roberson
2011-12-21
What does
opengl info
say? For me it says Version = 1.5 Mesa 6.0.1
Brian
2011-12-21
Walter Roberson
2011-12-21
That doesn't happen to mention the card model of your card. When I poke around the FireGL drivers, it appears the drivers are generally in the 8 series of versions, and it appears there is a beta version from January,
http://support.amd.com/us/gpudownload/fire/Pages/fire_beta_linux.aspx?type=2.4.3;2.4.5;2.4.7&product=2.4.3.3.2.3.17&lang=us&rev=8.801%20Beta&ostype=Linux%20x86_64
reference page http://support.amd.com/us/psearch/Pages/psearch.aspx?type=2.4.3%3b2.4.5%3b2.4.7&product=2.4.3.3.2.3.17&contentType=GPU+Download+Detail&ostype=Linux+x86_64&keywords=&items=20
If you are using the most recent driver, perhaps you could consider installing Mesa ?
Brian
2011-12-21
Oliver Woodford
2011-12-24
0 个投票
To get transparency in vector graphics output, export your figure to an SVG file. Then convert to any other vector format you want using an external application such as Inkscape.
Lisandro
2014-9-23
0 个投票
Hi, I had the same issue (I could print the figures using 'opengl software' but I couldn't with 'opengl hardware' in Matlab) and the problem was solved when I updated the video drivers
In my case I was using Ubuntu 12.04 (and afterwards 14.04) with an Intel Ivy Bridge. I downloaded and installed Mesa plus the Intel graphics Downloader manager (it's in the Ubuntu repository).
The problem was solved after I upgraded the drivers to their latest version.
Hope this helps
Best
Catherine
2014-11-11
Hi,
I had a similar problem trying to export figures with transparency (patch objects with the FaceAlpha property set to 0.5 for instance) in a PNG format with export_fig.
I filed a support request at MathWorks and the thing that resolved the issue was to set the OpenGL option 'software' to 'true' before doing anything else.
So just after startup, I type :
>> opengl software
And the call to export_fig works fine. I get a PNG file with transparency.
Hope this can help!
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!