Creating mandala graphics

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
lelldorin
Posts: 8
Joined: 2017-06-11T13:56:45-07:00
Authentication code: 1151

Creating mandala graphics

Post by lelldorin »

Hello all,

can i create mandala images with ImageMagick?

Something like this for example: https://www.pinterest.de/pin/609252655810502594

Greetings lelldorin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Creating mandala graphics

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Creating mandala graphics

Post by fmw42 »

I just uploaded a new script, mandala, to create Mandala type image from simple graphic shapes. See my link below.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Creating mandala graphics

Post 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 ^
      %OUTFILE%
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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Creating mandala graphics

Post by fmw42 »

GeeMack,

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.
Post Reply