How to Create a Simple Image Editor with CSS Filters and jQuery ? Last Updated : 01 Aug, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report CSS filter property is used to edit images or visual effects without the need for any specialized software. CSS filters work with a default value, so they don't offer users any control in changing their intensity.jQuery changes the value of intensity in CSS filters dynamically and thus gives the user complete control over the image. Syntax: .demo { filter: <filter-function> [<filter-intensity>];}Example: Here’s how would you apply a 50% blur filter to an element..demo { filter: blur(50%);}Image filter: To create an image filter, we have sliders for input variables that pass the value for intensity of each filter via jQuery and that filter will be applied through CSS.Project Structure:File structureExample: In this example, we will design the structure by using the HTML in demo.html file. After that we will use the filter by using CSS in demo.css file and then provide the control of those filters using JavaScript in demo.js file. demo.html <!DOCTYPE html> <html> <head> <!-- Add CSS file --> <link rel="stylesheet" href="demo.css" /> <!-- Add JQuery --> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"> </script> <!-- Add JavaScript file --> <script> $(document).ready(function () { $(".fit-val").change(main); }); </script> <script src="demo.js"></script> </head> <body> <div id="main"> <!-- Add Slider Controls --> <div class="range_panel"> <span> <label>GrayScale</label> <br /> <input id="id1" class="fit-val" type="range" min="0" max="100" value="0" /> </span> <span> <label>Blur</label> <br /> <input id="id2" class="fit-val" type="range" min="0" max="10" value="0" /> </span> <span> <label>Exposure</label> <br /> <input id="id3" class="fit-val" type="range" min="0" max="200" value="100" /> </span> <span> <label>Sepia</label> <br /> <input id="id4" class="fit-val" type="range" min="0" max="100" value="0" /> </span> <span> <label>Opacity</label> <br /> <input id="id5" class="fit-val" type="range" min="0" max="100" value="100" /> </span> <span> <label>Contrast</label> <br /> <input id="id6" class="fit-val" type="range" min="0" max="100" value="100" /> </span> <span> <label>Invert</label> <br /> <input id="id7" class="fit-val" type="range" min="0" max="100" value="0" /> </span> <span> <label>Saturate</label> <br /> <input id="id8" class="fit-val" type="range" min="0" max="100" value="100" /> </span> </div> <div class="image"> <img src="demo.png" /> <img src="demo.png" class="image_main" /> </div> </div> </body> </html> demo.css /** @format */ body { text-align: center; color: white; } .main { width: 100vw; display: flex; } .range_panel { background-color: rgb(39, 39, 39); width: 300px; height: 100vh; padding: 30px; padding-top: 100px; } span { display: block; margin: 10px; } .image { padding: 100px; } .image img { width: 30vw; } demo.js function main() { $(".image_main").css( "-webkit-filter", "grayscale(" + $("#id1").val() + "%) blur(" + $("#id2").val() + "px) brightness(" + $("#id3").val() + "%) sepia(" + $("#id4").val() + "%) opacity(" + $("#id5").val() + "%) contrast(" + $("#id6").val() + "%) saturate(" + $("#id7").val() + "%) invert(" + $("#id8").val() + "%)" ); } Output: Comment More infoAdvertise with us Next Article How to Create a Photo Slideshow with fadeIn and fadeOut using jQuery ? M mishrapriyank17 Follow Improve Article Tags : Web Technologies JQuery CSS-Properties jQuery-Selectors HTML-Questions jQuery-Questions +2 More Similar Reads How to Create a Custom Image Magnifier using jQuery ? Glimpse of Image magnifier: An image magnifier is the zooming capability of your cursor point. Where you placed your cursor in the define div the image will be popped out in zoom mode. Like in the shopping sites, when you want to purchase any kind of cloth and want to check the material or print on 4 min read How to get a div's background image with jQuery ? The task is to get a div's background image with jQuery. You can achieve this task by using the CSS() method in jQuery. In simple words, we need to create an empty div and on click event, the empty div will get the image as a background. CSS(): This is an inbuilt method in jQuery to add the CSS prop 2 min read How to create responsive image gallery using HTML, CSS, jQuery and Bootstrap? With the advent of new frameworks in web technologies, it has become quite easy to design and implement feature-rich and responsive web pages. Here, we are going to design a responsive image gallery using HTML, CSS, jQuery, and Bootstrap. Features or Functionalities to implement:Responsive imagesRes 3 min read How to create a drag and drop feature for reordering the images using HTML CSS and jQueryUI ? In this article, we are given an images gallery and the task is to re-arrange the order of images in the list or grid by dragging and dropping. The jQuery UI framework provides a sortable() function that helps in re-ordering list items by using the mouse. With this functionality, the list items beco 3 min read How to Create a Photo Slideshow with fadeIn and fadeOut using jQuery ? In this article, we are going to create a simple slideshow with jQuery fadeIn() and fadeOut() functions. Approach:For the slideshow effect for all the images, we are going to use the JavaScript setInterval() function. This function calls a function or evaluates an expression at specified intervals w 2 min read How to create and use CSS Image Sprites ? In this article, we are going to learn how we can how to create and use CSS Image Sprites.CSS Image Sprites are nothing but a way to reduce the HTTP requests from the image resources. A CSS Image Sprite is a single image file containing all images on a document page. Image sprites are advantageous s 3 min read Like