image-filter web component
This is a web component for applying different filters to your image.
Using this component
Add the following script tag in the head of your .html page
<script type="module" src="https://unpkg.com/image-filter-component@0.0.2/dist/image-filter/image-filter.esm.js"></script>
Then in your html or jsx
<image-filter
src="beach-time.jpg"
alt="Children at the beach"
width="500"
filter="sepia"></image-filter>
API
image-filter properties
- src (string)
- alt (string)
- width (string)
- height (string)
- class (string) : allows you to apply your own styles
- filter (string) : supported values shown below
Supported Filter Values
- sepia
- invert
- grayscale
- blur
- contrast
- saturate
- huerotate
- shadow
- opacity
Demo
- Look at the DEMO and see the different styles applied
Script tag
- Put a script tag similar to this
<script type='module' src='https://unpkg.com/image-filter-component@0.0.2/dist/image-filter/image-filter.esm.js'></script>
in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc
- Remember to add type="module" on your script tag as shown above
Node Modules
- Run
npm install image-filter-component --save
- Put a script tag similar to this
<script type='module' src='node_modules/image-filter-component/dist/image-filter/image-filter.esm.js'></script>
in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc
- Remember to add type="module" on your script tag as shown above