1

I am using Asymptote to create 3D graphics, which I export to PNG-files. I would like to have a transparent background in the PNG-file.

For 2D graphics, I can easily get a transparent background when I export from Asymptote. However, for 3D graphics I have so far been unable to get a transparent background.

I have tried

currentlight.background=opacity(0.0)+rgb(255,255,255);

but this just produces a white background in the PNG-file.

Does anybody know if it is possible to obtain a transparent background when exporting 3D graphics from Asymptote to a 2D rendered file format?

3
  • I think it is not possible. The only workaround (as explained in a old post) is to use convert and to transform the white color into the transparent one. – O.G. Jul 12 '17 at 20:52
  • Thank you for your answer. I have seen some of the old posts suggesting to use the "convert" command in ImageMagick to convert the white background into a transparent background, so I might have to try that. Maybe in a future version of Asymptote this will be implemented. – Henrik Jul 19 '17 at 13:18
  • Perhaps it is possible to add in the code of asymptote (glrender.cc) a subroutine which creates directly the png file with transparent background. It needs some C++ and OpenGL knowledge. – O.G. Jul 25 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.