당신이 더 중요한 (sRGB)의 자리 (X %를 X의 % X %)을
을 보장하는 형식으로 조정할 수 있나요
다른 IM 버전이있을 가능성이 있습니다. IM 7.0.7.8은 srgb (93.0648 %, 11.1254 %, 14.1741 %)를 보여줍니다. IM 6.9.9.20은 정수를 보여줍니다. 나는 IM 6 명령 행에 -precision 4를 추가하려고 시도했지만 여전히 정수를 얻는다. 더 많은 정밀도를 얻으려면 txt : 출력 형식을 구문 분석해야합니다.
구문 분석하지 않고 예를 들어
:
convert xc:"cmyk(0,255,255,0)" -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc txt:
# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (60990,7291,9289) #EE3E1C7B2449 srgb(93%,11%,14%)
그래서 당신은 괄호 (IM Q16의 경우) 16 비트 값을 구문 분석 할 필요가있다, 즉, (60990,7291,9289)
vals=`convert xc:"cmyk(0,255,255,0)" \
-profile /Users/fred/images/profiles/USWebCoatedSWOP.icc \
-profile /Users/fred/images/profiles/sRGB.icc txt: |\
tail -n +2 | sed -n 's/^.*[(]\(.*\)[)][ ]*\#.*$/\1/p'`
red=`echo $vals | cut -d, -f1`
green=`echo $vals | cut -d, -f2`
blue=`echo $vals | cut -d, -f3`
red=`convert -precision 4 xc: -format "%[fx:100*$red/quantumrange]" info:`
green=`convert -precision 4 xc: -format "%[fx:100*$green/quantumrange]" info:`
blue=`convert -precision 4 xc: -format "%[fx:100*$blue/quantumrange]" info:`
color="srgb($red%,$green%,$blue%)"
echo "$color"
srgb(93.06%,11.13%,14.17%)
원하는 유효 자릿수에 대해 -precision을 조정하십시오.
참고 : IM 7에서는 -precision이 작동합니다.
magick xc:"cmyk(0,255,255,0)" -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc -format "%[pixel:u.p{0,0}]\n" info:
srgb(93.0648%,11.1254%,14.1741%)
magick -precision 4 xc:"cmyk(0,255,255,0)" -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc -format "%[pixel:u.p{0,0}]\n" info:
srgb(93.06%,11.13%,14.17%)
magick -precision 2 xc:"cmyk(0,255,255,0)" -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc -format "%[pixel:u.p{0,0}]\n" info:
srgb(93%,11%,14%)
https://github.com/halostatue/color를 보셨습니까? – msanford
@msanford 나는 생각했지만 사용 예제를 찾을 수 없었다. 어떤 튜토리얼/API를 알고 있습니까? – sambecker
아니요, 테스트를 통해 구현 방법을 확인하실 수 있습니다. https://github.com/halostatue/color/blob/master/test/test_cmyk.rb – msanford