Added support for gAMA chunk and white point calculation.
This commit is contained in:
parent
e6ea2bfd35
commit
ec6b39eb3c
@ -280,13 +280,25 @@
|
||||
Dim offset As Integer = 0
|
||||
For Each pointname As String In {"white point", "red", "green ", "blue"}
|
||||
Dim xcounts, ycounts As UInteger
|
||||
Dim extrainfo As String = ""
|
||||
xcounts = BigEndianUInt32(data, offset)
|
||||
ycounts = BigEndianUInt32(data, offset + 4)
|
||||
|
||||
Console.WriteLine("{0}: x = {1:g} y = {2:g}", pointname, xcounts / 100000.0, ycounts / 100000.0)
|
||||
'Calculate color temperature of white point
|
||||
If pointname = "white point" Then
|
||||
Dim n As Double = ((xcounts / 100000.0) - 0.332) / ((ycounts / 100000.0) - 0.1858)
|
||||
Dim cctapprox As Double = (-449 * n ^ 3) + (3525 * n ^ 2) - (6823.3 * n) + 5520.33
|
||||
extrainfo = " (" & cctapprox.ToString("F0") & " K)"
|
||||
End If
|
||||
|
||||
Console.WriteLine("{0}: x = {1:g} y = {2:g}{3}", pointname, xcounts / 100000.0, ycounts / 100000.0, extrainfo)
|
||||
|
||||
offset += 8
|
||||
Next
|
||||
|
||||
Case "gAMA"
|
||||
Dim gammacounts As UInteger = BigEndianUInt32(data)
|
||||
Console.WriteLine("gamma: 1/{0:g5}", 1 / (gammacounts / 100000.0))
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user