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

How to obtain images in the mask #251

Open
more-strive opened this issue Apr 19, 2024 · 0 comments
Open

How to obtain images in the mask #251

more-strive opened this issue Apr 19, 2024 · 0 comments

Comments

@more-strive
Copy link

test
image

source = io.StringIO(svg_image)
svg = SVG.parse(source)
for element in svg.elements():
    if isinstance(element, SVGImage):
          try:
              element.load(os.path.dirname('./'))
              mask = element.values.get('mask')
              if mask:
                  mask_name = mask.replace('url', '').replace('(', '').replace(')', '').replace('#', '')
                  mask_object = svg.objects.get(mask_name)
                  # mask_object = { image:  ...}
              url = element.url
          except OSError:
              pass

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