Skip to content

Make sure effects and other color management is being calculated in linear RGB space. #353

@Giwayume

Description

@Giwayume

Here's a fun fact, I found out that most CSS filters are hacks that don't do proper color space conversions that regular image editors do.

For example, css filter: blur(5px). You can see a dark line in the middle where green and red are merged.

image

Here is the same image with a gaussian filter in GIMP.

image

The reason behind this is most images are encoded in the sRGB color space. Working directly on pixels without converting sRGB to linear sRGB first results in mistakes like this. A typical editor workflow is:

  1. Convert your source images from sRGB to linear sRGB
  2. Run your edits/compositing operations using the linear sRGB colors
  3. At the very end, convert linear sRGB back to sRGB for display.

I know the hue-rotate filter also has an issue where it is approximating the rotation in sRGB space instead of properly converting to HSV/HSL first, rotating, then converting back to sRGB. It may be beneficial to implement "slow, but correct" versions of these filters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions