108 lines
2.7 KiB
Bash
Executable file
108 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
basename=
|
|
manufacturer=
|
|
model=
|
|
while getopts "hm:b:n:" flag
|
|
do
|
|
case $flag in
|
|
h)
|
|
usage
|
|
exit
|
|
;;
|
|
n)
|
|
basename=${OPTARG}
|
|
case ${basename} in
|
|
*/*)
|
|
echo "'/' is forbidden in basename"
|
|
exit 1
|
|
;;
|
|
esac
|
|
;;
|
|
b)
|
|
manufacturer=${OPTARG}
|
|
;;
|
|
m)
|
|
model=${OPTARG}
|
|
;;
|
|
esac
|
|
done
|
|
|
|
usage()
|
|
{
|
|
echo "Usage: $0 [options]"
|
|
echo " -n <name> : profile basename"
|
|
echo " -b <brand> : monitor manufacturer"
|
|
echo " -m <model> : monitor model"
|
|
}
|
|
|
|
if [ "${basename}" == "" -o "${manufacturer}" == "" -o "${model}" == "" ]
|
|
then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
##############
|
|
# parameters #
|
|
##############
|
|
|
|
screen="1,1"
|
|
|
|
# Température
|
|
temp=6500 # temperature K. Si vide => temperature native
|
|
# luminance
|
|
bright=100 # point blanc en cd/m²
|
|
# Gamma
|
|
gamma=2.4 # gamma standard
|
|
|
|
# infos profil
|
|
description="${manufacturer} ${model} - ${bright}cd@${temp}K-${gamma}"
|
|
|
|
########
|
|
# code #
|
|
########
|
|
|
|
trap 'exit 1' SIGINT
|
|
|
|
# Veille off
|
|
echo "== disabling DPMS =="
|
|
xset s off -dpms
|
|
# reinit LUT
|
|
echo "== reset monitor LUT =="
|
|
argyll-dispwin -d ${screen} -c
|
|
# monitor calibration
|
|
echo "== starting monitor calibration =="
|
|
temp_arg=""
|
|
if [ "${temp}" != "" ]
|
|
then
|
|
temp_arg="-t ${temp}"
|
|
fi
|
|
if [ "${bright}" != "" ]
|
|
then
|
|
bright_arg="-b ${bright}"
|
|
fi
|
|
# for -y parameter, see https://www.argyllcms.com/doc/instruments.html#i1d3
|
|
argyll-dispcal -d ${screen} -v -q m -y n -k 0 ${temp_arg} ${bright_arg} -g ${gamma} -o targen.icc "${basename}"
|
|
# create patches
|
|
echo "== generating patches =="
|
|
argyll-targen -v -d 3 -G -c targen.icc "${basename}"
|
|
rm -f targen.icc
|
|
# read patches
|
|
echo "== reading patches =="
|
|
argyll-dispread -d ${screen} -v -y n -k "${basename}.cal" "${basename}"
|
|
# create icc profile
|
|
echo "== generation icc profile =="
|
|
# see http://www.argyllcms.com/doc/colprof.html#a
|
|
# Currently using shaper profile (Relative colorimetry rendering intent, perceptual is not handled)
|
|
# To use perceptual, re-enable XYZ profile, but this is poorly handled by eg firefox (or not at all by chrome) and perceptual has no visible benefits in most cases
|
|
#argyll-colprof -v -A "${manufacturer}" -M "${model}" -D "${description}" -q m -a x -d mt -s 20 -O "${basename}-xyz.icc" "${basename}"
|
|
argyll-colprof -v -A "${manufacturer}" -M "${model}" -D "${description}" -q h -a s -d mt -O "${basename}-shaper.icc" "${basename}"
|
|
rm -f gammap.wrl
|
|
# load profile to LUT
|
|
echo "== loading ${basename}.icc profile =="
|
|
argyll-dispwin -d ${screen} -I "${basename}-shaper.icc"
|
|
# veille on
|
|
echo "== enabling DPMS =="
|
|
xset s reset +dpms
|
|
|