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

Transparent background issue #51

Closed
dburgosp opened this issue Sep 6, 2019 · 2 comments
Closed

Transparent background issue #51

dburgosp opened this issue Sep 6, 2019 · 2 comments

Comments

@dburgosp
Copy link

dburgosp commented Sep 6, 2019

Hi.

Nice library, thanks a lot :)

I am having problems when loading some SVG with transparent background, for example https://back.webel.es/v1/images/categorias/5c12552f15e4fd133439cd97.svg

The transparent background appears black on an Android device using Sharp. Any idea?

Thanks in advance.

@pflammertsma
Copy link
Collaborator

It appears that the cause of this issue is the <clipPath> tag as this is not supported by Sharp. Instead of interpreting this as a clipping path, Sharp simply renders the content. Since the enclosed rect is by default filled as black, the a 300x300 black rectangle is rendered before any other content.

There are two possible workarounds:

  1. Specify the fill opacity of the clipping path as transparent by setting fill-opacity="0" on the enclosed rect, or
  2. Remove the clipping path altogether.

Perhaps a future version will ignore clipping path altogether as I think it's a bit too ambitious to implement clipping paths as per the SVG spec.

@pflammertsma
Copy link
Collaborator

This issue is related to #19.

pflammertsma pushed a commit that referenced this issue Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants