Page 1 of 1

Creating mandala graphics

Posted: 2017-11-25T11:36:23-07:00
by lelldorin
Hello all,

can i create mandala images with ImageMagick?

Something like this for example:

Greetings lelldorin

Re: Creating mandala graphics

Posted: 2017-11-25T13:42:01-07:00
by fmw42
There are no automatic tools to generate such patterns that I know about. But you can create Mandelbrot and JuliaSet patterns with my scripts of the same name at my link below. I also have scripts, kaleidoscope and kaleidoscopic.

Re: Creating mandala graphics

Posted: 2017-12-01T16:09:29-07:00
by fmw42
I just uploaded a new script, mandala, to create Mandala type image from simple graphic shapes. See my link below.

Re: Creating mandala graphics

Posted: 2017-12-01T20:23:51-07:00
by GeeMack
fmw42 wrote: 2017-12-01T16:09:29-07:00I just uploaded a new script, mandala, to create Mandala type image from simple graphic shapes. See my link below.
It looks like your link to the script hasn't updated yet, but the example figures look like the script can do some pretty cool stuff.

I've been fascinated by ImageMagick's power to do some wildly complex things within a single command, and I spent a lot of time working up a kaleidoscope script for IM7 and Windows. This command takes any image or even the system clipboard as input, makes a kaleidoscope of the given number of slices, and outputs the final design as a square the size of the height of the input image.

Code: Select all

set INIMAGE=input.jpg
set OUTFILE=kaleidoscope.png
set SLICES=12

magick ^
   %INIMAGE% ^
   -alpha set ^
   -background none ^
   -virtual-pixel mirror ^
   -set option:distort:viewport %[fx:ceil(h*tan((180/%SLICES%)*pi/180))]x%[h] ^
   -distort affine "%[fx:w/2],0 0,0" ^
   -distort affine "0,0 %[w],0  0,%[h] 0,%[h]  1,%[h] 1,%[h]" ^
   -virtual-pixel none ^
   -distort affine "0,%[h] %[w],%[h]  0,0 0,0  1,0 1,0" ^
   -virtual-pixel mirror ^
   -set option:distort:viewport %[fx:w*2]x%[h] ^
   -distort SRT 0 ^
   -duplicate %[fx:%SLICES%-1] ^
   -virtual-pixel none ^
   -set option:distort:viewport %[h]x%[h] ^
   -distort SRT "%[fx:w/2],%[h]  0.71  %[fx:t*360/n]  %[fx:h/2],%[fx:h/2]" ^
   +repage ^
   -flatten ^
   -alpha off ^
This should work by setting the three variables and simply copying and pasting at the Windows command prompt. To put it in a Windows BAT script requires changing the single percent signs "%" to doubles "%%" everywhere except the %INIMAGE%, %OUTFILE%, and %SLICES% variables.

To convert to a *nix script requires changing the continued line carets "^" to backslashes "\", and may need quoting or escaping some other characters. The way the variables are set and read would also need a tweak. I don't have IM7 on a *nix system to check it.

For my own use I generate a random number for the %SLICES% variable. I also "-normalize" just before the output to punch up the colors. The command above is pretty much just the engine that does the real work of calculating the angles, cutting the slices, and assembling them to create the ouput image.

Re: Creating mandala graphics

Posted: 2017-12-01T22:18:16-07:00
by fmw42

Thanks for notifying me of the problem. It was a cut and paste error. I have fixed it, so the script can be download.

Thanks for you kaleidoscope command. I have two scripts also: kaleidoscope and kaleidoscopic.

I will check your code out when I have time tomorrow.