unjs / ipx

🖼️ High performance, secure and easy-to-use image optimizer.
MIT License
2k stars 65 forks source link

Add new modifiers for `opacity` and `brightness` #240

Open hacknug opened 1 month ago

hacknug commented 1 month ago

Describe the feature

I would like to propose adding a couple new modifiers for opacity and brightness (and probably background too as a side-effect of adding the first to avoid limiting the output to PNG).

Right now I'm using CSS to achieve the desired output (via tailwind's opacity-75 brightness-125) but that messes with the color for ::selection which is something that triggers my OCD lol

I know I could modify the displayed image on any image editor but I thought this could be something useful to add to ipx so others can benefit of the changes.

Not sure how viable is this. Lmk if I can help in any way 👍

Additional information

hacknug commented 1 month ago

The requested functionality seems to be available in imgproxy via the brightness and colorize options.

colorize is basically the equivalent of my proposed solution with opacity and background, only using an overlay instead of an underlay.