carbon / Heif

A C# wrapper around libheif
MIT License
5 stars 4 forks source link

Expose ColorProfile data #4

Open iamcarbon opened 4 years ago

iamcarbon commented 4 years ago

API proposal coming soon.

iamcarbon commented 4 years ago
class HeifImage 
{
     public HeifColorProfileType ColorProfileType { get; }
     public HeifIccColorProfile? GetIccColorProfile();
     public HeifNclxColorProfile? GetNclxColorProfile();
}

public enum HeifColorProfileType
{
     NotPresent,
     Icc,
     Nclx
}

public class HeifIccColorProfile
{
     public bool IsRestricted { get; } // if rICC
     public byte[] Data { get;}
}

public class HeifNclxColorProfile
{
     public HeifColorPrimariesType ColorPrimariesType { get; } 
     public HeifTransferCharacteristicsType TransferCharacteristicsType { get; }
     public HeifMatrixCoefficientsType MatrixCoefficientsType { get; }
     public bool IsFullRange { get; }
     public HeifColorPrimaries ColorPrimaries { get; }
}

public readonly struct HeifColorPrimaries 
{ 
     public Vector2 R { get; }
     public Vector2 G { get; }
     public Vector2 B { get; }
     public Vector2 W { get; }
}

public enum HeifColorPrimariesType 
{
     BT_709_5 = 1,
     Unspecified = 2,
     BT_470_6M = 4,
     BT_470_6BG = 5,
     BT_601_6 = 6,
     SMPTE_240M = 7
}

public enum HeifTransferCharacteristicsType
{
     BT709_5 = 1,
     Unspecified = 2,
     BT470_6M = 4,
     BT_470_6_BG = 5,
     BT_601_6 = 6,
     SMPTE_240M = 7,
     Linear = 8,
     IEC_61966_2_4 = 11,
     BT_1361 = 12,
     IEC_61966_2_1 = 13
}

public enum HeifMatrixCoefficientsType
{
     RGB_GBR = 0,
     BT_709_5 = 1,
     Unspecified = 2,
     FCC_T47 = 4,
     BT_470_6_BG = 5,
     R_BT_601_6 = 6,
     SMPTE_240M = 7,
     YCgCo = 8
}
iamcarbon commented 4 years ago

@dlemstra Let me know your thoughts here.