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

Opacity not applied on images #235

Closed
gdetrez opened this issue Mar 27, 2019 · 0 comments
Closed

Opacity not applied on images #235

gdetrez opened this issue Mar 27, 2019 · 0 comments

Comments

@gdetrez
Copy link

gdetrez commented Mar 27, 2019

Hil Thanks for a nice and useful tool/library!

I'm not sure I'm doing it correctly but I can't apply transparency to included images.
I'm trying to do it by applying style="opacity: 0.5" to the <image/> element. This seems to produce the expected resust with inkscape but not cairosvg. I made an example graphic to demonstrate what is happening: (image is from ttps://www.w3.org/Icons/SVG/svg-logo-v.png)

<?xml version="1.0" encoding="utf-8" ?>
<svg
    width="100" height="200"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" >
  <rect fill="red" x="40" y="0" width="20" height="200" />
  <image
      xlink:href="svg-logo-v.png"
      x="15" y="15" width="71" height="71"
      style="opacity: 0.5" />
  <rect
      fill="green"
      x="15" y="115" width="71" height="71"
      style="opacity: 0.5" />
</svg>

Here's the result I get by converting with inkscape (0.92.4, inkscape -e inkscape.png test.svg, left) and cairosvg (2.3.0, cairosvg -o cairosvg.png $PWD/test.svg, right):
inkscapecairosvg

It seems that both honor the opacity style of the <rect/> element but cairosvg doesn't honor it on the <image/>.

olf42 added a commit to sophiamanns/schreibdochmalwieder that referenced this issue Jul 16, 2019
@liZe liZe closed this as completed in 73349a7 Dec 10, 2020
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

1 participant