plot_sRGB_EOTF.m 600 Bytes
Newer Older
Pekka Paalanen's avatar
Pekka Paalanen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% SPDX-FileCopyrightText: 2021 Collabora, Ltd.
% SPDX-License-Identifier: MIT

% This is an Octave script: https://www.gnu.org/software/octave/

s = 0.04045;

e = [0 : 0.01 : 1];

o = zeros(size(e));

mask = e <= s;

o(mask) = e(mask) ./ 12.92;
o(~mask) = realpow((e(~mask) + 0.055) ./ 1.055, 2.4);

f = figure();
plot(e, o);
xticks([0:0.1:1])
yticks([0:0.1:1])
grid on
title('sRGB EOTF')
xlabel('electrical / non-linear value')
ylabel('optical / linear value')
axis square tight

ppi = get(0, 'ScreenPixelsPerInch');
set(f, 'PaperPosition', [0 0 400 400] ./ ppi)

print(f, 'sRGB_EOTF.png', '-dpng')