bwoodsend / vtkplotlib

VTK (C++ 3D graphics library) wrapped into an easy to use 3D equivalent of matplotlib
MIT License
40 stars 6 forks source link

Background transparency #12

Closed ploner closed 2 years ago

ploner commented 2 years ago

Btw, great library! I was not able to save a 3D mesh into a 2D PNG with transparent background. Tried:

vpl.gcf() is fig 
vpl.mesh_plot(mesh)
fig.background_color = [0, 0., 0., 0.]
vpl.save_fig('fig.png', magnification=1, off_screen=True) 

Did I miss something? Thanks.

bwoodsend commented 2 years ago

Ahh, now that reminds me that yonks ago, someone went and addressed that and I meant to cherry-pick it but didn't. Hang on whilst I do that...

bwoodsend commented 2 years ago

Ughh, I keep forgetting how much I dislike working on this project. It's like tiptoeing through a minefield made out of seg-faults.

I've got a change ready. Mind giving it a go?

pip install https://github.com/bwoodsend/vtkplotlib/archive/refs/heads/background-opacity.zip

then just rerun your code.

ploner commented 2 years ago

Yes, will check it today. Thx!

On 15 May 2022, at 22:59, Brénainn Woodsend @.***> wrote:

Ughh, I keep forgetting how much I dislike working on this project. It's like tiptoeing through a minefield made out of seg-faults.

I've got a change ready. Mind giving it a go?

pip install https://github.com/bwoodsend/vtkplotlib/archive/refs/heads/background-opacity.zip then just rerun your code.

— Reply to this email directly, view it on GitHub https://github.com/bwoodsend/vtkplotlib/issues/12#issuecomment-1127029404, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZC6TK6EC27AJB6RNVOB6LVKFQR3ANCNFSM5VXXFIDQ. You are receiving this because you authored the thread.

ploner commented 2 years ago

It worked! The resulting PNG file has a transparent background as requested! Do you merge the code into the main branch? Thanks a lot!

bwoodsend commented 2 years ago

Cool, I'll merge it into master then release it then.

ploner commented 2 years ago

Perfect - thank you!

On Mon, May 16, 2022 at 11:08 PM Brénainn Woodsend @.***> wrote:

Cool, I'll merge it into master then release it then.

— Reply to this email directly, view it on GitHub https://github.com/bwoodsend/vtkplotlib/issues/12#issuecomment-1128136576, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZC6TO3F7PXV6MS5NZNZELVKK2LBANCNFSM5VXXFIDQ . You are receiving this because you authored the thread.Message ID: @.***>