# How can I superimpose points or disks on an image at specified coordinates?

I have a TIFF image of 640 x 640 pixels, over which I would like to plot a list of points or disks of small radius.

I have been testing different alternatives and I found ImageCompose command.

ImageCompose[image, {Graphics[{PointSize[.009], Black, Point[{0, 0}]}], .6}, {600, 600}]


This places a point at location {600, 600} relative to the origin at the left-bottom of the image, but if I set a point close to the right edge of the image, say {635, 600}, the point is in the frame but there is no image behind it, because the image is not showing all its pixels. It appears that the first 20-25 pixels of the image and the last 20-25 pixels of the image are invisible.

When I tick the image it shows the image at the center of the frame and two blank vertical spaces at right and left of the image.

Two questions:

• Does there exist any option or command I could use to show the full image, i.e., the entire 640 x 640 pixels?

• How can I superimpose a list of points (e.g., 40 points) at specified pixel coordinates within the same image.

Show will display Image and Graphics simultaneously, placing both in the same system coordinate - this is why it is convenient in your case.

i = ImageTake[  ExampleData[{"TestImage", "Girl3"}], {60, 160}, {100, 200}];
Show[i, Graphics[{Red, Opacity[.5], PointSize[.005],
Point[Flatten[Table[{i, j}, {i, 100}, {j, 100}], 1]]}], ImageSize -> 500]


Let's see in detail what is happening. This is simple 3px by 3px image:

i = Image[HilbertMatrix[3]]


By controlling an offset 0 < d < 1 you can place your points precisely around your pixels. For example this proves that with d = -.5 all 9 points are inside the image on the centers of pixels. Nothing gets out. You can control offset as you wish.

d = -.5;
Show[i, Graphics[{Red, Opacity[.5], PointSize[.1],
Point[Flatten[Table[{i, j}, {i, 3}, {j, 3}], 1] + d]}], ImageSize -> 500]


• Thanks. Very straightforward solution. I still have the two blank strips at the right and left of my image. If I place a point Point[{5, 55}], then it appears with white background. Should I export the image with some option to remove the white between the image and the frame of the image?
– PLM
Commented Dec 17, 2012 at 17:49
• @PLM Does PlotRangePadding -> 0 help? Commented Dec 17, 2012 at 18:37
• I have tested like Show[im, {Graphics[{PointSize[.009], Black, Point[{5, 55}]}]}, PlotRangePadding -> 0] and still is outside the image. How can I make the image full visible?
– PLM
Commented Dec 17, 2012 at 18:47
• Perfect Thank you very much
– PLM
Commented Dec 17, 2012 at 19:43
• @PLM I updated the answer. Commented Dec 17, 2012 at 19:48

Is HighlightImage, a neat addition for version 9, any use here? It takes a list of coordinates, and various highlighting techniques as options:

i = ImageAdjust[
ImageResize[
ExampleData[{"TestImage", "Mandrill"}], {640, 640}], {-0.5, -0.1}];

HighlightImage[i, {{600, 600}, {635, 600}}, Method -> {"DiskMarkers", 6}]