Skip to content

Plotly.toImage: add format to remove all semi-transparent elements #4433

Description

@antoinerg

In order to add EMF support in Orca (plotly/orca#152), we had to remove all semi-transparency because EMF does not support it. At the time, we did this work in Orca itself. However, as @etpinard pointed out in plotly/orca#152 (comment)

We could even move this compatibility logic to plotly.js' Snapshot.toSVG - which already does a few similar things. I'm not sure if we should be adding a Plotly.toImage flag (e.g. noOpacity) or add a "format" (e.g. svg-for-emf)?

Thinking about this again, I think adding a noOpacity flag in plotly.js makes sense. There are probably other image formats out there that don't fully support an alpha channel. Now this doesn't solve all the EMF/Inkscape issues; perhaps these remaining issues could be handling in Orca? What do you think @antoinerg ?

@etpinard was clairvoyant in this regard: EPS also does not support semi-transparency. When it's present, it leads to ugly rasterization (see plotly/orca#248 for details).

Therefore I think it would make sense to add a new format to Plotly.toImage to remove all semi-transparent elements. Its name could be svg-opaque.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions