2013-06-16 2 views
1

json 입력 파일을 기반으로 사용자 정의 재생 카드를 생성하는 go 스크립트를 구현했습니다. 출력은 svg입니다. 카드를 인쇄하려면 카드를 PNG로 변환해야합니다. 따라서 ImageMagick을 설치했습니다.Imagemagick이 LinearGradient의 방향을 바꿉니다.

convert output.svg output.png 

이는 SVG 태그는 다음과 같습니다 :

나는 변환 명령 줄 도구를 사용하고

<?xml version="1.0"?> 
<!-- Generated by SVGo --> 
<svg width="630" height="891" 
    xmlns="http://www.w3.org/2000/svg" 
    xmlns:xlink="http://www.w3.org/1999/xlink"> 
<defs> 
<linearGradient id="h" x1="0%" y1="100%" x2="0%" y2="0%"> 
<stop offset="0%" stop-color="red" stop-opacity="1.00"/> 
<stop offset="100%" stop-color="rgb(255,255,255)" stop-opacity="1.00"/> 
</linearGradient> 
</defs> 
<rect x="0" y="0" width="630" height="891" style="fill:black"/> 
<rect x="10" y="10" width="610" height="871" style="fill:url(#h)"/> 
<text x="20" y="89" style="fill:black;font-size:30pt;text-anchor:start">1 Sold</text> 
<text x="610" y="89" style="fill:black;font-size:30pt;text-anchor:end">Gegenstand</text> 
<line x1="20" y1="98" x2="610" y2="98" style="stroke:black;stroke-width:3"/> 
<text x="20" y="151" style="font-family:monospace;fill:black;font-size:25pt;text-anchor:start">Bogen</text> 
<text x="20" y="534" style="fill:black;font-size:20pt;text-anchor:start">Wird in einer Schmiede hergestellt</text> 
<text x="20" y="579" style="fill:black;font-size:20pt;text-anchor:start"></text> 
<text x="20" y="623" style="fill:black;font-size:15pt;text-anchor:start">Vor dem Kampf hat der Bogenschütze eine Wahrscheinlichkeit</text> 
<text x="20" y="641" style="fill:black;font-size:15pt;text-anchor:start">von 4,5,6 dass der dem Gegner einen Lebenspunkt abzieht</text> 
</svg> 

당신이 SVG 파일이 붙여 넣기하고 브라우저에서 열면 배경이 선상도 (lineargradient)가있는 rect임을 알 수 있습니다. 카드 하단이 빨간색으로 위쪽이 천천히 흰색으로 변합니다. 카드에

enter image description here

언어는 독일어이지만, 텍스트는 중요하지 않다 : PNG로 파일을 변환 한 후에는 다음과 같습니다. 올바르게 렌더링됩니다. 문제는 거꾸로 된 그라디언트입니다. 처음에는 Gimp로 카드를 디자인했지만 그 과정을 자동화하기로 결정했습니다. 불행히도 나는 이미 많은 카드를 인쇄했으며 레이아웃을 일관성있게 유지하고자합니다.

나는 뒤집힌 그라디언트가 내 잘못이 아니라고 오히려 확신합니다. Chrome, Firefox 및 Internet Explorer에서 동일한 이미지가 표시됩니다. 어쩌면 ImageMagick의 사용법이 잘못되었을 수 있습니까?

다른 도구를 사용 하시겠습니까?

+0

그라디언트의 색상과 방향이 변경되었습니다. 이 "이중 부정"은 svg 레이아웃에는 영향을 미치지 않지만 ImageMagick은 이미지를 올바르게 변환합니다. 귀하의 의견을 답장으로 할 수 있습니다. 악이 그것을 받아 들인다. – lhk

답변

1

linarGradient를 y1 = "0 %"및 y2 = "100 %"로 변경 한 다음 정지 색상의 오프셋을 바꾸면 ImageMagick에서 해당 버그를 해결할 수 있습니다.

관련 문제