Skip to content

Add color space configuration feature#89

Open
ltatarev wants to merge 1 commit into
candlefinance:mainfrom
ltatarev:add-set-colorspaces
Open

Add color space configuration feature#89
ltatarev wants to merge 1 commit into
candlefinance:mainfrom
ltatarev:add-set-colorspaces

Conversation

@ltatarev

Copy link
Copy Markdown
Contributor

Added setColorSpace function needed on iOS as a way to configure the color space for image processing.

This change was needed to ensure consistency when displaying images with color matrix filters across iOS, Android, and web platforms. Android defaults to sRGB color space, and achieving parity with this behavior was the primary motivation for this implementation.

Changes:

  • iOS Implementation: Added setColorSpace() static method to FasterImageViewManager that configures the global CIContext. The initial approach was to pass colorSpace as a prop, but was unsuccessful because CIContext configuration must be set globally at initialization rather than per-image. Supports sRGB, displayP3, linearSRGB, and genericRGB color spaces.

  • Android Limitation: Coil 2.4.0 does not expose ImageLoader.Builder.colorSpace() (available in Coil 3.x), preventing color space configuration at the loader level. Implementation would require a custom decoder component to apply the color space during decoding, which is more complex and less reliable than using the native API. The Android implementation could be revisited if/when upgrading to Coil 3.x.

Visual examples from example app show how the update looks on iOS:

iOS, no filter, no color space iOS, "bright" color matrix filter, no color space iOS, "bright" color matrix filter, sRGB color space
ios no filter no colorspace ios filter no colorspace ios filter sgrb colorspace
Android, no filter Android, "bright" color matrix filter
android no filter android filter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant