ImageMagick&饼状图 [英] ImageMagick & Pie Charts

查看:199
本文介绍了ImageMagick&饼状图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在现有图像中使用ImageMagick绘制饼图的最直接方法是什么?例如,如果给出以下输入,我将如何绘制单个切片?


  • 中心点(x,y)

  • 半径

  • 百分比


解决方案

<使用SVG创建你的饼形楔子;我从这里获得了示例

 < svg> 
style =fill:#ff0000;
fill-opacity:1;
stroke:black;
stroke-width:1/>
< / svg>

然后,使用ImageMagick将图片叠加到您的背景图片上。

  composite.exe -background none -size 200x200 .\pie_wedge.svg .\background.png out.png 



请注意,您必须使用笛卡尔坐标而不是半径来定义弧,但转换应该相当简单。


What is the most direct way to draw a pie chart using ImageMagick in an existing image. For example, how would I draw a single slice given the following inputs?

  • A center point (x,y)
  • Radius
  • Percent

解决方案

Create your pie wedge using SVG; I got my example from here:

<svg>
<path d="M200,200 L200,20 A180,180 0 0,1 377,231 z"
    style="fill:#ff0000;
        fill-opacity: 1;
        stroke:black;
        stroke-width: 1"/>
</svg>

Then, overlay that image using ImageMagick to your background image.

composite.exe -background none -size 200x200 .\pie_wedge.svg .\background.png out.png

Note that you have to define your arcs with cartesian coordinates instead of radius, but the conversion should be fairly straightforward.

这篇关于ImageMagick&amp;饼状图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆