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

Remove semi-transparent edges get when applying the gaussian blur with 'feComponentTransfer' #5

Open
jasomdotnet opened this issue Mar 11, 2017 · 4 comments

Comments

@jasomdotnet
Copy link

jasomdotnet commented Mar 11, 2017

Add 'feComponentTransfer' into svg filter in order to remove semi-transparent edges:

  <filter id="blur" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
    <feGaussianBlur stdDeviation="20 20" edgeMode="duplicate" />
    <feComponentTransfer>
      <feFuncA type="discrete" tableValues="1 1" />
    </feComponentTransfer>
  </filter>

Now you fix it by this:

/* Add this CSS to remove transparent border around the image */
left: -10%;
width: 120%;

See this article.

@msurguy
Copy link
Owner

msurguy commented Mar 11, 2017

Thanks @jasomdotnet ! I will check out the article as time permits, but if possible, could you make a PR for these issues? I would really appreciate if you can get something together

@jasomdotnet
Copy link
Author

jasomdotnet commented Mar 12, 2017 via email

@jasomdotnet
Copy link
Author

jasomdotnet commented Mar 12, 2017

Code before:

before

  1. Add color-interpolation-filters="sRGB" for removal of color cascade Strange 'color cascade' when applying blur to image #7
  2. Double the blur value for better blur Add double blur value into 'feGaussianBlur' #6
  3. Add feComponentTransfer for removal of semi-transparent borders Remove semi-transparent edges get when applying the gaussian blur with 'feComponentTransfer' #5

Code after:

after

Generally, I recommend you to make background-blur able to generate same svg code as in article mentioned above, because @emilbjorklund, the author, seems to be more sophisticated user then me or you :-) when it comes to svg images.

@emilbjorklund uses also edgeMode="duplicate" or filterUnits="userSpaceOnUse" which I don't know what it does but it can backfire for some users with older browsers (IE8, IE9, IE7...) if omitted.

This is the complete svg code from an article:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1500" height="823" viewBox="0 0 1500 823"> <filter id="blur" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> <feGaussianBlur stdDeviation="20 20" edgeMode="duplicate" /> <feComponentTransfer> <feFuncA type="discrete" tableValues="1 1" /> </feComponentTransfer> </filter> <image filter="url(#blur)" xlink:href="https://www.example.com/image.jpg" x="0" y="0" height="100%" width="100%"/> </svg>

@Jagathishrex
Copy link

how can i implement background, motion and zoom blur in svg without css

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

3 participants