PeachImage
PeachImage
IccColorProfile Class
A parsed ICC color profile, exposing PeachImage’s optimized, colorimetric device→sRGB conversion to library consumers directly — the same engine JPEG decode already uses automatically for a CMYK source with an embedded profile (see GetIccColorProfile() and ConvertToSrgb() for the common case of converting an already-decoded Image). Supports Gray, RGB, and CMYK device color spaces — whatever the profile itself declares via DataColorSpace.
public sealed class IccColorProfile
Inheritance System.Object → IccColorProfile
Remarks
Immutable and safe to use concurrently from multiple threads once constructed: parsing happens once, in the constructor, and ConvertToSrgb(ReadOnlySpan<byte>, Span<byte>, int, Nullable<IccRenderingIntent>, bool) is pure computation over caller-supplied buffers with no shared mutable state.
| Constructors | |
|---|---|
| IccColorProfile(ReadOnlySpan<byte>) | Parses profileBytes as an ICC profile. |
| Properties | |
|---|---|
| ChannelCount | The number of device channels ConvertToSrgb(ReadOnlySpan<byte>, Span<byte>, int, Nullable<IccRenderingIntent>, bool) expects per pixel (1 for Gray, 3 for Rgb, 4 for Cmyk). |
| DataColorSpace | The device color space this profile’s transform expects. |
| DefaultRenderingIntent | The profile’s own declared default rendering intent, used by ConvertToSrgb(ReadOnlySpan<byte>, Span<byte>, int, Nullable<IccRenderingIntent>, bool) when its intent parameter is null. |
| Methods | |
|---|---|
| ConvertTo(IccColorProfile, ReadOnlySpan<byte>, Span<byte>, int, Nullable<IccRenderingIntent>, bool) | Converts pixelCount pixels of normalized device values from this profile’s device space to destination’s device space, routing both profiles’ device↔PCS transforms through the shared D50 profile connection space they each resolve to internally -- so this is the same operation whether destination is a CMYK output-intent profile (converting RGB-authored content into it) or another device space entirely (e.g. one CMYK profile into another). ConvertToSrgb(ReadOnlySpan<byte>, Span<byte>, int, Nullable<IccRenderingIntent>, bool) is this same conversion against a fixed, built-in sRGB destination, independently optimized since sRGB’s device→PCS direction never varies. |
| ConvertToSrgb(ReadOnlySpan<byte>, Span<byte>, int, Nullable<IccRenderingIntent>, bool) | Converts pixelCount pixels of normalized device values to RGBA32 (alpha always 255), using this profile’s real device→PCS transform — a colorimetric, optimized (SIMD-tailed, allocation-free) conversion, not a naive formula. |
| TryCreate(ReadOnlySpan<byte>, IccColorProfile) | Attempts to parse profileBytes as an ICC profile, returning false instead of throwing on any failure. |