Reputation: 82
I have a single dimensional array with 8 values. I want to create a grayscale image with those values. The image consist of a square with provided width and length. inside that square i want to produce circles with array values. The values from the array will be the radius of the circles. I need a grayscale image of that circle. Any help???
Upvotes: 2
Views: 375
Reputation: 207550
You can use ImageMagick for this, either directly from the commandline or from C/C++, Perl, Python, PHP etc.
Start with convert
to get a white square 100pixels by 100pixels.
convert -size 100x100 xc:white circles.jpg
Change colour or file extension as you wish, e.g.
convert -size 200x200 xc:black circles.gif
Now add two circles with centre 50,50
convert -size 100x100 xc:white \
-draw "circle 50,50,60,50" \
-draw "circle 50,50,70,50" \
circles.jpg
The \
is just a line continuation.
Back at my desk now.... so, here is a command:
#!/bin/bash
convert -size 400x400 xc:white -fill transparent \
-stroke gray90 -draw "circle 200,200,260,200" \
-stroke gray80 -draw "circle 200,200,280,200" \
-stroke gray70 -draw "circle 200,200,300,200" \
-stroke gray60 -draw "circle 200,200,320,200" \
-stroke gray50 -draw "circle 200,200,340,200" \
-stroke gray40 -draw "circle 200,200,360,200" \
-stroke gray30 -draw "circle 200,200,380,200" \
-stroke gray20 -draw "circle 200,200,400,200" \
circles.jpg
and the result:
Maybe you can execute it in Java with:
Runtime.exec(...)
Upvotes: 1