Wilco
Wilco

Reputation: 33356

ImageMagick & Pie Charts

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?

Upvotes: 2

Views: 1771

Answers (1)

Jason R. Coombs
Jason R. Coombs

Reputation: 42694

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.

Upvotes: 3

Related Questions