To solve this problem, and using the filter brightness
, we can use the property clip:
The clip property allows you to specify a rectangle for
cut an absolutely positioned element. The rectangle is
specified as four coordinates, all from the top corner
left of the element to be cut.
As I did not read the question correctly, I did the reverse that you asked, ie the track have filter brightness
:
.brightness div{
position:absolute;
overflow:hidden;
}
#filter img{
-webkit-filter:brightness(200%);
filter:brightness(200%);
}
#filter{
position:absolute;
clip: rect(30px, auto, 90px, auto);
/* (top, right, bottom, left) */
}
<div class="brightness">
<div id="original">
<img src="https://image.freepik.com/fotos-gratis/laptop-na-mesa-do-escritorio_426-19315253.jpg">
</div>
<div id="filter">
<img src="https://image.freepik.com/fotos-gratis/laptop-na-mesa-do-escritorio_426-19315253.jpg">
</div>
</div>
Then I did what you want to do:
.brightness div{
position:absolute;
overflow:hidden;
}
#noFilter{
position:absolute;
clip: rect(30px, auto, 90px, auto);
/* (top, right, bottom, left) */
}
#original img{
-webkit-filter:brightness(200%);
filter:brightness(200%);
}
<div class="brightness">
<div id="original">
<img src="https://image.freepik.com/fotos-gratis/laptop-na-mesa-do-escritorio_426-19315253.jpg">
</div>
<div id="noFilter">
<img src="https://image.freepik.com/fotos-gratis/laptop-na-mesa-do-escritorio_426-19315253.jpg">
</div>
</div>
thank you so much for the tip.
– Murilo Pecht