Package: juliart
Julia Art "juliart"This module is based on theColor Julia Botbut intended for command line generation, and with options to customize colors
based on themes (holidays, seasons) and also generate animations.
The name "juliart" is also a play on word (Juliard) to hint
at artsy things.I've done my best so that the default parameters produce (what I think to be)
the most random and pretty images. You can of course tweak the parameters
to your liking, discussed below!Examples and DocumentationIf you want to jump in to examples, see these repositories:vsoch/juliart-says: write Markov generated (or raw) text onto a Julia Set imagevsoch/juliart-grid: a grid of Julia Sets to show indexing into the Mandelbrot Setvsoch.github.io: A writeup of Juliart, explaining Julia and Mandelbrot sets.UsageInstallYou can install from pypipipinstalljuliartor install from the repository directly:$gitclonehttps://github.com/vsoch/juliart
$pythonsetup.pyinstallfor animations you'll also need an extra package:pipinstalljuliart[animate]Generate ArtYou can see basic usage by typingjuliartinto your terminal:$juliart
usage:juliart[-h][--version]{generate,animate}...

JuliaSetartgenerator

optionalarguments:-h,--helpshowthishelpmessageandexit--versionsuppressadditionaloutput.

actions:actionsforJuliaSetartgenerator{generate,animate}juliartactionsgenerategenerateaJuliaSetimageanimatecreateaJuliaSetanimation(gif)You'll see there are two options: to generate, and to animate.GenerateCustomizations for the generate command generally include color or theme choices,
an optional text to print on the graphic, and parameters.$juliartgenerate--help
usage:juliartgenerate[-h][--radiusRADIUS][--outfileOUTFILE][--textTEXT][--fontsizeFONTSIZE][--xcoordXCOORD][--ycoordYCOORD][--caCA][--cbCB][--resRES][--iterITERS][--color{random,pattern,glow}][--rgbRGB][--theme{christmas,easter,fall,random,halloween,hanukkah,spring,summer,thanksgiving,valentine,winter}][--zoomZOOM]optionalarguments:-h,--helpshowthishelpmessageandexit--radiusRADIUSthemaxradiustoallow(defaultis4)--outfileOUTFILEtheoutputfiletosavetheimage(defaultstorandomlygeneratedpng)--textTEXTwriteastringoftexttobottomleftcorner--fontsizeFONTSIZEfontsizeoftext(ifdesired)defaultsto16--xcoordXCOORDxcoordinatefortext(defaultsto0)--ycoordYCOORDycoordinatefortext(defaultsto0)--caCAtheacomponentofthecparameter--cbCBthebcomponentofthecparameter--resREStheresolutiontogenerate(defaultsto1000)--iterITERSthenumberofiterationsperpixel(defaultsto200)--color{random,pattern,glow}acolorpatterntofollow.--rgbRGBaspecificrbgcolor,informatR,G,B--theme{christmas,easter,fall,random,halloween,hanukkah,spring,summer,thanksgiving,valentine,winter}athemetocolortheart(defaultstorandomcolors)--zoomZOOMthelevelofzoom(defaultsto1.8)DefaultsIf you use the defaults, it will generate a randomly named image in your
present working directory.$juliartgenerate
GeneratingJuliaSet...
Savingimagetodoopy-kerfuffle-5780.pngC ParametersThe values of ca and cb (the real and complex components of the c parameter
in the Julia Set equation) are chosen at random, but you can select them
to better understand how your choices influence the graphic generation:juliartgenerate--ca0.5--cb0.5I also created asmall projectthat will visually show how your parameter selection
influences the resulting image! You might want to give the output file a more meaningful name:juliartgenerate--ca0.5--cb0.5--outfileca-0.5-cb-0.5.pngAnd if you intend to compare the images, setting a consistent color is also
reasonable:juliartgenerate--ca0.5--cb0.5--outfileca-0.5-cb-0.5.png--rgb90,12,10For a bigger deep dive into this exercise (I was curious) seeJuliart Grid.TextAs an alternative to file name (or just to have some fun!) you can generate
an image with a custom message.juliartgenerate--text"Dinosaurs are great!"By default the text will be printed in the top left corner (coordinate 10,10)
however you can adjust this to your liking:$juliartgenerate--text"Avocados are also great!"--xcoord200--ycoord20You can also change the font from OpenSans-Regular.ttf to Pacifico-Regular.ttf,
and choose an alpha (transparency).$juliartgenerate--text"Avocados!"--fontsize30--font-alpha90--fontPacifico-RegularYou can see all of these examples in thetextexamples folder.Zoom, Iterations, and RadiusOtherwise you can do any of the customizations shown above! Try playing
around with iterations, colors/themes, and zoom to see different effects.$juliartgenerate--zoom3$juliartgenerate--iter100After looking over the equation to generate the JuliaSet for a while,
I got the insight that if we increase the iterations value and modify the radious,
this will generate more detailed images. Here are some examples:juliartgenerate--iter1000--radius8juliartgenerate--iter5000--radius10This one takes longer, of course.Interactive PythonTo generate from within Python, here is a quick example:fromjuliart.mainimportJuliaSetjuliaset=JuliaSet(resolution=1000,# (1000x1000)color="random",# random, glow, patterntheme="random",rgb=None,# "197,18,12"iterations=200,)juliaset.generate_image(zoom=1.8)juliaset.save_image("/tmp/myimage.png")If you want to add text, before the save_image do:juliaset.write_text(text,fontsize=16,xcoord=10,ycoord=10,)By default, the text is white. You can change the color (and add a transparency, alpha layer)
like:juliaset.write_text(text,fontsize=16,xcoord=10,ycoord=10,rgb=(255,255,255,15),)AnimateYou can inspect the parameters for the animation command as follows:$juliartanimate--help
usage:juliartanimate[-h][--no-cleanup][--constant-a][--constant-b][--randomize-zoom][--zoom-maxZOOM_MAX][--zoom-minZOOM_MIN][--framesFRAMES][--outfileOUTFILE][--textTEXT][--fontsizeFONTSIZE][--xcoordXCOORD][--ycoordYCOORD][--caCA][--cbCB][--resRES][--iterITERS][--color{random,pattern,glow}][--rgbRGB][--theme{christmas,easter,fall,random,halloween,hanukkah,spring,summer,thanksgiving,valentine,winter}][--zoomZOOM]optionalarguments:-h,--helpshowthishelpmessageandexit--no-cleanupDonotdeletetemporarydirectorywithpngfilestogenerategif.--constant-aDon't randomize the point A on the circle.--constant-b          Don'trandomizethepointBonthecircle.--randomize-zoomRandomizethezoomupto--zoom-minor--zoom-max.--zoom-maxZOOM_MAXthemaxzoom(mustbegreaterthan3)--zoom-minZOOM_MINthemaxzoom(mustbegreaterthan0)--framesFRAMESthenumberofframestogenerate(defaultis30)--outfileOUTFILEtheoutputfiletosavetheimage(defaultstorandomlygeneratedpng)--textTEXTwriteastringoftexttobottomleftcorner--fontsizeFONTSIZEfontsizeoftext(ifdesired)defaultsto16--xcoordXCOORDxcoordinatefortext(defaultsto0)--ycoordYCOORDycoordinatefortext(defaultsto0)--caCAtheacomponentofthecparameter--cbCBthebcomponentofthecparameter--resREStheresolutiontogenerate(defaultsto1000)--iterITERSthenumberofiterationsperpixel(defaultsto200)--color{random,pattern,glow}acolorpatterntofollow.--rgbRGBaspecificrbgcolor,informatR,G,B--theme{christmas,easter,fall,random,halloween,hanukkah,spring,summer,thanksgiving,valentine,winter}athemetocolortheart(defaultstorandomcolors)--zoomZOOMthelevelofzoom(defaultsto1.8)Most of these defaults (mins and maxes) are fairly reasonable and you wouldn't
want to change them. By default, we will vary both the A and B constants that
are used to generate the Julia Set, but we won't vary the zoom.DefaultsThe defaults will generate a 30 framed animation, varying the parameters
A and B but not the zoom, with resolution (1000 X 1000) and 200 iterations.$juliartanimate--frames5OptimizeYou can make that faster by changing the iterations and resolution, of course!$juliartanimate--res500--iters100The tradeoff is image quality. You'll also notice in the case of generating
black pixels it takes slightly longer than white pixels (since white is
an absence of color).TextYou can add a consistent message to all frames in an animation:juliartanimate--text"Dinosaurs are great!"and customize the--xcoord,--ycoord, or--fontsizeparameters as
desired. See thetextexamples folder for an example. If you want
to vary the text between frames, then you'll need to roll your own
loop to generate the frames and then combine into an animation. An example
is provided, the code atJuliart Grid.CleanupIf you want to keep the temporary png images (the frames) you can do:$juliartanimate--no-cleanupFramesIf you want to customize the number of frames, you can do that too (we default to 30). Here
would be a smaller / quicker to generate image:$juliartanimate--frames5ZoomTo also randomize the zoom, specify:$juliartanimate--randomize-zoom--frames5PythonTo generate from within Python, it's fairly straight forward:fromjuliart.mainimportJuliaSetAnimationjuliaset=JuliaSetAnimation(resolution=args.res,color=args.color,theme=args.theme,rgb=args.rgb,cleanup=notargs.skip_cleanup,iterations=args.iters,zoom_max=args.zoom_max,zoom_min=args.zoom_min,)juliaset.generate_animation(zoom=args.zoom,outfile=args.outfile,frames=args.frames,randomize_a=notargs.constant_a,randomize_b=notargs.constant_b,randomize_zoom=args.randomize_zoom,)ColorsThe three choices for colors are random, pattern, or glow, or setting your
own RGB value.RandomRandom is the default, and the image at the top of the README here is generated using
this setting. Take a look at moremore random examples.PatternPattern doesn't use a gradual gradient, but instead returns a hard boundary between
a color (and black).Take a look at moremore pattern exampleshere.RGBIf you want complete control of the color, provide a comma separated list
of RGB numbers as follows:$juliartgenerate--rgb9,35,155Note that this will also work with the--color patternflag.GlowGlow means a dark background (black) with a color gradient. Here is an example:And is generated as follows:juliartgenerate--colorglowSeemore glow examples.If you choose glow, this will overwrite the choice of a theme (discussed next).ThemesTo get a little more variety in your choice of colors, you can select a theme!juliartgenerate--themehalloween
juliartgenerate--themechristmas
juliartgenerate--themehanukkah
juliartgenerate--themethanksgiving
juliartgenerate--themevalentine

juliartgenerate--themeeaster
juliartgenerate--themefall
juliartgenerate--themespring
juliartgenerate--themesummer
juliartgenerate--themewinterFor any of the commands above, you can also add--color patternto flip the background
from the theme color to be black.$juliartgenerate--themehalloween--colorpatternTake a look at images in thethemes folderto get a sense of the color palettes.DockerYou can run the pre-generated Docker container too! You'll need to bind a folder
on the host to save the image to.$mkdirdata
$dockerrun-it-v$PWD/data/:/dataquay.io/vanessa/juliartgenerate--outfile/data/art.pngYou can also build the image first if you like:$dockerbuild-tquay.io/vanessa/juliart.The images are provided onquay.io/vanessa/juliart.SupportDo you have a question? Or want to suggest a feature to make it better?
Pleaseopen an issue!