0

Let's say I have an website with many pictures. None of them are using the transparency feature from gif or png and all have black backgrounds to fit cleanly in a website with black background.

Maybe I'm wrong but I think there was a possibility to set an specific color to be not shown and configured as transparent to see through to the elements behind.

So for example: I want to change the background of my website to blue but I don't want to edit every picture's black background. I was thinking of an CSS attribute for a picture to say for example... make all black transparent.

I can't edit the picture files so I need such an alternative.

Is there something like this?

thx

fpdragon
  • 1,867
  • 4
  • 25
  • 36

1 Answers1

1

No, there is nothing like this in CSS. You can achieve this using canvas (see https://hmp.is.it/creating-chroma-key-effect-html5-canvas/) but this is not a sustainable solution for using on regular images on your website.

Your best bet is to use some sort of image modification script to make the images transparent, or edit them by hand.

Tennyson H
  • 1,705
  • 15
  • 28