Open In App

SVG <feFuncB> Element

Improve
Improve
Like Article
Like
Save
Share
Report

SVG stands for Scalable Vector Graphic. It can be used to make graphics and animations like in HTML canvas. SVG has been developed by the World Wide Web Consortium (W3C) since 1999.

SVG <feFunB> element: These elements are typically children of the feComponentTransfer element and specify the transfer functions of the blue component of the input graphic of its parent <feComponentTransfer> element.

Syntax:

<feComponentTransfer>       
    <feFuncB type="" tableValues=""/>
</feComponentTransfer>

Attributes: It does not have any specified attribute but it accepts Global attributes.

Example 1: The following code demonstrates the <feFuncB> element with type “table”.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>SVG feFuncB Element</title>
</head>
  
<body>
    <svg width="640" height="550" 
        viewBox="0 0 640 550">
          
        <defs>
            <filter id="new" 
                filterUnits="objectBoundingBox" 
                x="0%" y="0%" width="100%" 
                height="100%">
  
                <feComponentTransfer>
                    <feFuncB type="table" 
                        tableValues="1 1 0 0" />
                </feComponentTransfer>
            </filter>
        </defs>
  
        <image x="10" y="10" width="280" 
            height="350" 
            preserveAspectRatio="true"
            xlink:href=
        <image x="310" y="10" width="280" 
            height="350" preserveAspectRatio="true" 
            filter="url(#new)"
            xlink:href=
    </svg>
</body>
  
</html>


Output:

 

Example 2: The following code demonstrates the <feFuncB> element with the type “gamma”.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>SVG feFuncB Element</title>
</head>
  
<body>
    <svg width="640" height="550" 
        viewBox="0 0 640 550">
        <defs>
            <filter id="new" 
                filterUnits="objectBoundingBox" 
                x="0%" y="0%" width="100%" 
                height="100%">
                <feComponentTransfer 
                    in="BackgroundImage" 
                    result="A">
                    <feFuncB type="gamma" 
                        amplitude="0" eponent="1" 
                        offset="0.5" />
                </feComponentTransfer>
            </filter>
        </defs>
  
        <image x="10" y="10" width="280" 
            height="350" 
            preserveAspectRatio="true"
            xlink:href=
        <image x="310" y="10" width="280" 
            height="350" 
            preserveAspectRatio="true" 
            filter="url(#new)"
            xlink:href=
    </svg>
</body>
  
</html>


Output:

 

Example 3: The following code demonstrates the <feFuncG> element with the type “discrete” and attributes like “amplitude”,”exponent”,”offset” are set with values.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>SVG feFuncB Element</title>
</head>
  
<body>
    <svg width="640" height="550" 
        viewBox="0 0 640 550">
        <defs>
            <filter id="new" 
                filterUnits="objectBoundingBox" 
                x="0%" y="0%" 
                width="100%" height="100%">      
                 
                <feComponentTransfer 
                    in="BackgroundImage" result="A">            
                    <feFuncB type="discrete" 
                        tableValues="1 0 0 0"/>              
                </feComponentTransfer
            </filter>
        </defs>
          
        <image x="10" y="10" width="280" 
            height="350" 
            preserveAspectRatio="true" 
            xlink:href=
        <image x="310" y="10" width="280" 
            height="350" 
            preserveAspectRatio="true" 
            filter="url(#new)" 
            xlink:href=
    </svg>
</body>
  
</html>


Output:

 



Last Updated : 04 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads