# Image with disks of increasing size

I would like to produce a black image with superposed white disks.

• The disk centers should start from the lower left and end at the upper right position.

• The disk size should increase lineary from lower left to upper right position.

What I tried:

n = 400;
imageData = Array[0 &, {n, n}];
image = Image[imageData];

array = Table[{i, i}, {i, 1, n}];
objects = Table[Image@DiskMatrix[i/10 // N], {i, 1, n, 1}];

ImageCompose[image, objects, array]


Result:

As you see this the diagonal is not white.

My expected results should be:

How can this be done?

• Wouldn't it be more convenient to use Disk / Table / Rasterize? – Kuba Feb 21 '17 at 11:02
• @Kuba: Could you please show a code snipplet? – mrz Feb 21 '17 at 11:09

Like this?

Graphics[{White, Table[
Disk[{i, i}, .2 i],
{i, 10}]}, Background -> Black]


EDIT: If, for some reason, you want to do this with arrays and images instead of Graphics, you can use InverseDistanceTransform to turn a 2d array of radii into an image of overlapping discs:

dist = Image[
SparseArray[Table[{5 i, 5 i} -> i, {i, 1, 20, 5}], {100, 100}]]


InverseDistanceTransform[dist]


• Great solution ... thanks – mrz Feb 21 '17 at 11:12

another approach, close to the original. ImageCompose one disk at a time then ImageMultiply the results. For this to work we need to work in negative images, so you start with a white "canvas" and multiply by black (0) disks. (then negate the final result)

imageData = Array[1 &, {n, n}];
image = Image[imageData];
array = Table[{i, i}, {i, 1, n, 20}];
objects =
Table[ColorNegate@Image@(DiskMatrix[i/10 // N]), {i, 1, n, 20}];
ColorNegate@
ImageMultiply[image,

I expect you can see in the original form ImageCompose was covering prior white disks with the black border of the next disk image. To illustrate, colorize the black part of the individual disk images:
objects = Table[ColorReplace[Image@DiskMatrix[i/10 // N],