NewImage 함수를 사용하여 JSL 2D 매트릭스를 이미지로 변환할 수 있습니다. 2D 행렬과 이미지는 많은 메모리를 사용합니다. 색상 값으로 가득 찬 30K x 30K 매트릭스를 만들어 표시할 수 있습니다. PNG 파일로 저장하려면 더 작은 크기를 시도해야 할 수도 있습니다. 20K x 20K가 저에게 효과적이었습니다. 다음은 메모리에 동시에 여러 개의 행렬 복사본이 있는 것을 방지할 수 있는 방법에 대한 설명이 포함된 JSL입니다.
clear globals();
// notes on making big images
//
// a 20Kx20K matrix is 20000*20000*8/1024/1024/1024 = 3GB
// the image created from it will be at least half that size too, in memory.
// clear globals, above, makes sure old matrices are released, otherwise
// m=J(...) might have the old matrix in m on the left hand side while the
// new matrix is being created on the right hand side. Two copies at once.
// the parallel assign below is designed to do all the processing on an element.
// using m = f(m) later creates extra copies, and single-threaded. The
// commented-out range(m) was from previous runs to figure out the
// -1.1 and /1.5 scaling on the mandelbrot results. The critical
// part is making the RGB color from f1(m), f2(m), f3(m) inside the
// parallel assign. Otherwise there could be four! copies of m if
// newimage("rgb", {f1(m), f2(m), f3(m)})
// ---
// the above was important for a 30Kx30K matrix, using ~7GB; my machine
// could not hold ~28GB at once. But I had to reduce it to 20K anyway to
// save the picture; somewhere bigger than 20K refuses to save the image.
m = J( 20000, 20000, . );
Parallel Assign( {}, m[r( -1.5, 1.5 ), c( -2.25, 0.75 )] = //
(//
x = ((Mandelbrot( 10000, 0, c, r ) ^ .1) - 1.1) / 1.5 ; // scaled counts
RGB Color( (x) ^ .5, (x) ^ 9, (1 - x) ^ 9 ) ; // keep final color
) //
);
//Show( Range( m ) ); // m holds JSL colors not mandelbrot counts. range is meaningless
m=newimage(m);
New Window( "m", m );
m<<SAVEPICTURE></SAVEPICTURE>There are two choices with NewImage: a single matrix containing JSL rgb colors, or three matrices of r, g, and b values between 0 and 1. The JSL shown uses the first choice because only one matrix needs to exist. The second choice is more flexible but will require, at least for a moment, four matrices to exist.
The attached picture is 20,000 by 20,000 pixels; depending on your viewer you'll want to scroll or zoom.