Last active
December 18, 2015 00:19
-
-
Save unot/5696282 to your computer and use it in GitHub Desktop.
format RGB-CMYK LUT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
#trap "rm -f cmyk.csv rgb.txt" EXIT | |
if [ $# -ne 1 ]; then | |
echo "Usage: `basename $0` rgb_lab.h" | |
exit 1 | |
fi | |
if [ ! -e "$1" ]; then | |
echo "File \"$1\" not exist." 1>&2 | |
exit 1 | |
fi | |
LINES=`wc -l $1 | tr -d ' ' | sed -e 's/^\(....\).*/\1/'` | |
sed -e '1d' -e '$d' -e 's/,$//' "$1" >cmyk.csv | |
eval echo \{$(seq -s, 0 16 256)\},\{$(seq -s, 0 16 256)\},\{$(seq -s, 0 16 256)\}, | sed -e 's/ /\n/g' >rgb.txt | |
#echo {0,16,32,48,64,80,96,112,128,144,160,176,192,208,224,240,256},{0,16,32,48,64,80,96,112,128,144,160,176,192,208,224,240,256},{0,16,32,48,64,80,96,112,128,144,160,176,192,208,224,240,256}, | sed -e 's/ /\n/g' >rgb.txt | |
paste rgb.txt cmyk.csv | tr ',' '\t' | sed -e 's/\t\t/\t/g' -e 's/255/256/g' | |
rm -f cmyk.csv rgb.txt | |
if [ $LINES -ne 4915 ]; then | |
echo "File \"$1\" is not varid." 1>&2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment