2011년 5월 24일 화요일

ImageMagick Convert colorspace

ImageMagick Convert 명령어는 정말 강력하다.
hdr, exr, pfm 내가원가는 모든것을 지원한다. 특히 colorspace convert는 환상적이다. ㅋㅋㅋ

ex. linear to sRGB
convert -set colorspace sRGB -colorspace RGB inputfile outputfile

심각한 버그 발견!
colorspace 옵션이 붙으면 float이미지가 integer처럼 clipping된다.
해서... 직접 수식을 입력하여 colorspace를 변환 했다.

[linear to sRGB]
convert -fx "(p <= 0.0031308) ? 12.92*p : pow(1.055*p, 1.0/2.4)-0.055" inputfile outputfile

[srgb to linear]
convert -fx "(p <= 0.04045) ? 1/12.92*p : pow((p+0.055)/1.055, 2.4)" inputfile outputfile

댓글 없음: