简体   繁体   中英

How can I convert image white background color to transparent

I have a product image with white background color. Image source link comes from client side database. So, I need to convert image in to a transparent background color (from white) with JS or CSS .

Anyone know a better solution for this?

I heard about by adding bkgnd=transparent value to image URL, Is it a possible way?

Searched a lot time in google, but didn't get any proper solution.

See my code:

 .container { width: 100%; max-width: 600px; padding: 10px; background: url(https://picsum.photos/200/300) center center no-repeat; background-size: cover; } img { width: 100%; }
 <div class="container"> <img src="https://imgd.aeplcdn.com/1056x594/n/suk7osa_1474663.jpg?q=85"> </div>

JSFiddle

You should to use png without white background. You can not change opacity only white background and leave the car untouched

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM