2012-05-31 4 views
1

이미지에 반투명 배경이있는 캡션을 넣으려고합니다. 지금까지imagemagick 캡션 (반투명 배경 포함)

width=`identify -format %w dragon.gif`; \ 
convert -background '#0008' -fill white -gravity center -size ${width}x30 \ 
     caption:"Faerie Dragons love hot apple pies\!" \ 
     dragon.gif +swap -gravity south -composite anno_caption.jpg 

enter image description here

이 내 시도 :

은 문서에서 예제 ( http://www.imagemagick.org/Usage/annotating)입니다

convert -background transparent -colorspace transparent -fill white -gravity center -size 300x300 \ 
     -font fonts/customfont.ttf caption:'caption text here' \ 
     'cap.png' 

composite -geometry +0+0 'cap_1.png' 'img_1.jpg' 'img_2.jpg' 

캡션은 오른쪽 상단에 배치 된 만들어집니다 예상대로 합성 이미지의 원 coner. 유일한 문제는 캡션 배경이 검은 색이나 반투명이 아니라는 것입니다. Transcription (예 : convert -size 50x50 xc : '# 879'img.png)에 xc 명령을 사용한 것을 보았지만 캡션 bg 색상을 설정하는 명령을 적용하는 방법을 알지 못합니다.

편집 : 나는 그냥 EC2 서버에서 테스트 코드가 예상대로 작동

. 이 문제는 코드가 Mac 10.7x에서 실행될 때 발생합니다.

답변

6

투명성을 지닌 rgb (rgba)를 사용하고 있습니다. 예기치 않은 토큰 근처

convert -size 300x300 -background rgba\(0,255,255,0.25\) -fill white -gravity center caption:'caption text here' cap.png 

composite -geometry +0+0 cap.png img_1.jpg img_2.jpg 
+0

구문 오류 '(' – waigani

+0

탈출 해보십시오() 나는 오류뿐만 아니라 투명도 위의 코드를 수정하지 – Bonzo

+0

한 -.. 고체 청록색 배경 – waigani