Giter Site home page Giter Site logo

Image element not rendered about svgren HOT 5 OPEN

Maxador avatar Maxador commented on July 16, 2024
Image element not rendered

from svgren.

Comments (5)

Maxador avatar Maxador commented on July 16, 2024 1

Thanks for the suggestion but it won't cut it unfortunately. We decided to go through another route and stop using SVGs for this use case. It was getting too hacky 😅.

from svgren.

igagis avatar igagis commented on July 16, 2024

@Maxador Right, svgren doesn't render <image> elements.

Though, if you just need to achieve the same effect, i.e. blurred rectangle, you can use gaussian blur filter, like this:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="375" height="235" viewBox="0 0 375 235">

    <defs>
        <filter
                style="color-interpolation-filters:sRGB"
                id="the_blur_filter"
                x="-20%"
                width="140%"
                y="-20%"
                height="140%"
            >
            <feGaussianBlur
                    stdDeviation="10"
                    id="feGaussianBlur4620"
                />
        </filter>
    </defs>

    <rect id="white_background" x="0" y="0" width="100%" height="100%" fill="white" />

    <rect id="grey_blurred_rect" width="264" height="144" x="92" y="72" fill="grey" style="filter:url(#the_blur_filter)"/>

</svg>

from svgren.

Maxador avatar Maxador commented on July 16, 2024

Yeah I see, unfortunately I cannot do that because the same SVG is not rendering properly on another platform that doesn't handle filters/blurs properly.

from svgren.

igagis avatar igagis commented on July 16, 2024

I see. Well, let's keep this ticket open, but I'm not sure that drawing <image> elements will be implemented anytime soon. It is tricky, as the element can have transformations and thus some kind of scaling/rotation/skewing algorithms for raster image will have to be implemented which is far not trivial task. Perhaps you could look for ways to make that another platform support blur filter to resolve your problem.

from svgren.

igagis avatar igagis commented on July 16, 2024

@Maxador as a workaround, maybe you could have both elements in your SVG, the raster image and the rect with blur effect. One of those will be rendered only on one platform, the other one - only on another platform. But this is a dirty workaround and may lead to sudden breakages in case something changes on any of the platforms regarding the <image> element or blur support.

from svgren.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.