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.

  • $\begingroup$ Take a look at this answer: mathematica.stackexchange.com/a/3725/685 $\endgroup$
    – VLC
    Commented Dec 17, 2012 at 15:56
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign` $\endgroup$ Commented Dec 17, 2012 at 17:53

2 Answers 2


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]

enter image description here

Answer to comment

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

i = Image[HilbertMatrix[3]]

enter image description here

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]

enter image description here

  • $\begingroup$ 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? $\endgroup$
    – PLM
    Commented Dec 17, 2012 at 17:49
  • $\begingroup$ @PLM Does PlotRangePadding -> 0 help? $\endgroup$ Commented Dec 17, 2012 at 18:37
  • $\begingroup$ 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? $\endgroup$
    – PLM
    Commented Dec 17, 2012 at 18:47
  • $\begingroup$ Perfect Thank you very much $\endgroup$
    – PLM
    Commented Dec 17, 2012 at 19:43
  • $\begingroup$ @PLM I updated the answer. $\endgroup$ 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[
     ExampleData[{"TestImage", "Mandrill"}], {640, 640}], {-0.5, -0.1}];

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



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.