This is just a curiosity.
The session bellow is a toy example on the interaction with ImageMagick for
rendering images made from within Maxima. As long as I know, ImageMagick is
part of most linux distributions and there is an ms-windows compilation as
well. This program handles a lot of image formats and basic image
transformations.
I think making Maxima and ImageMagick working together opens the door for
considering Maxima as an image processing tool (filtering, random fields
image restoration, mathematical morphology, pattern reconigtion, ...).
Meanwhile, enjoy painting fractals!
For a quick view, this is the result of the following (linux) Maxima session:
http://www.telefonica.net/web2/biomates/maxima/fractal.png
Mario.
/* HERE BEGINS MAXIMA SESSION */
(%i1) fract(xmin,xmax,ymin,ymax,nr,nc,c):=
block([maxcolor:1,maxiter:50,bound:100,
zn,zn1,m,dx,dy,k,numer:true],
m: zeromatrix(nr,nc),
dx:(xmax-xmin)/nc,
dy:(ymax-ymin)/nr,
for i:1 thru nr do
for j:1 thru nc do(
zn:(xmin+(j-1)*dx) +%i*(ymin+i*dy),
k:1,
while k<=maxiter and abs(zn)maxiter then 1 else 0),
/* removes previous file fractal.pnm, if any */
system("rm fractal.pnm"),
/* saving the image in pnm format */
with_stdout("fractal.pnm",
print("P2"),
print(nr, nc),
print(maxcolor),
for i:1 thru nr do
for j:1 thru nc do
print(m[i,j])),
/* call ImageMagick and paint this sort of insect */
system("display fractal.pnm") )$
(%i2) showtime:true$
Evaluation took 0.00 seconds (0.00 elapsed) using 32 bytes.
(%i3) fract(-0.5,1.5,-1,1,300,300,1.64+0.96*%i);
Evaluation took 419.03 seconds (425.08 elapsed) using 8326622.844 KB.
(%o3) #
(%i4) /* format conversion */
system("convert fractal.pnm fractal.png")$
Evaluation took 0.02 seconds (0.08 elapsed) using 12.422 KB.
(%i5)
/* HERE ENDS MAXIMA SESSION */
--
--------------------------
Mario Rodriguez Riotorto
www.biomates.net