Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: export to image using active camera orientation and transparent background #289

Open
virtualdj opened this issue Aug 4, 2024 · 5 comments

Comments

@virtualdj
Copy link

I would like the Image output feature of File > Export selected items to obey the current camera view in the UI, if possible.
It would be great to have also a transparent background option when using formats that support it (such as PNG).

The Save View to image feature is not the same, because it also outputs the grid and controls.

Thanks for this wonderful piece of software! 😎

@HuguesDelorme
Copy link
Member

Unfortunately, to my knowledge OpenCascade 3D view doesn't support transparent background

@HuguesDelorme HuguesDelorme added this to the version/future milestone Aug 6, 2024
@virtualdj
Copy link
Author

OK, what a pity, it could have been useful to integrate into other apps... anyway, at least saving with same orientation could be enough 😃

@virtualdj
Copy link
Author

Unfortunately, to my knowledge OpenCascade 3D view doesn't support transparent background

Hi, sorry if I reply again, but I found this question on the OpenCascade forums.
I'm not really a C++ expert (actually I'm not a programmer at all), but could it be that changing this:

dumpOptions.BufferType = Graphic3d_BT_RGB;

to Graphic3d_BT_RGBA and providing the alpha component might work with PNG?

@HuguesDelorme
Copy link
Member

HuguesDelorme commented Aug 7, 2024

I tried this but couldn't make it work:

  • create a transparent PNG file
  • call V3d_View::SetBackgroundImage() with this PNG file(within ImageWriter::createV3dView() function)
  • set dumpOptions.BufferType = Graphic3d_BT_RGBA;(within ImageWriter::createV3dView() function)
  • set pixmap->SetFormat(Image_Format_RGBA);(within ImageWriter::createV3dView() function)
  • map QImage::Format_RGBA8888 to Image_Format_RGBA in function toQPixmap()(within qtgui_utils.cpp file)

The problem certainly lies with V3d_View not supporting transparent background(no alpha color channel)

@virtualdj
Copy link
Author

virtualdj commented Aug 7, 2024

  • create a transparent PNG file
  • call V3d_View::SetBackgroundImage() with this PNG file(within ImageWriter::createV3dView() function)

Why is it necessary to use SetBackgroundImage()? I would like the created image to be transparent, not to add a transparent image as a background. But I see now that V3d_View::SetBackgroundColor() doesn't have options for RGBA 😢 so probably we're in trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants