Hi guys i am trying to fill an image inside a png outline like this
Currently what i have
<img _ngcontent-udx-c1="" alt="content-icon" src="https://i.stack.imgur.com/ob90p.png" ng-reflect-ng-style="[object Object]" style="background: url("https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/nature-quotes-1557340276.jpg");">
where the event-icon.png is the white outline and the background is some random image from google. And the result is
But i want it do fill inside the other image's boundaries instead of just pushing it out through the entire tag. How can i achieve this?
You need to create another image like below and use it as mask:
body {
background:lightblue;
}
<img src="https://i.ibb.co/RyJRkpB/mask.png" />
<img src="https://i.stack.imgur.com/ob90p.png" />
In the above we have both images, the mask and the one with outline and you get the following if you combine them:
.box {
-webkit-mask:url(https://i.ibb.co/RyJRkpB/mask.png) center/contain no-repeat;
mask:url(https://i.ibb.co/RyJRkpB/mask.png) center/contain no-repeat;
background:url(https://picsum.photos/id/1014/800/800) center/cover;
}
body {
background:lightblue;
}
<img src="https://i.stack.imgur.com/ob90p.png" class="box">
The result isn't perfect because I am bad at image editing but you can easily edit the mask image to make it better
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments