Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there any way to add scale bar to a image for example. I just need to add a bar and a text on top of it to all my images without having to rewrite

Graphics[{Thick, Thick, Yellow, Line[{{100, 100}, {166, 100}}], 
        Text[Style["10 μ", Yellow, Bold, 25], {120, 110}]}]

for every image.

I just want to put this bar and text at left corner of the images I have.

1

share|improve this question
2  
I'm soooo photogenic! –  belisarius Nov 5 '13 at 1:39
    
But ... do you want to measure the white bar and resize your yellow scale accordingly? –  belisarius Nov 5 '13 at 1:45
    
Sorry Yes! I do want to change the numneric as the size of the bar varies. But how can I do that in terms of the horizontal pixel of the image. lets say its a 640x480 image. And a 100 pixels in 640 relates to 10 micron. If I change the bar length to 200 it should show 20. –  abhilash sukumari Nov 5 '13 at 1:47
add comment

1 Answer

Provided you have this image is in the same directory that your notebook with the name im.jpg, try this:

im = Import[NotebookDirectory[] <> "im.jpg"];
Show[{im}, 
 Epilog -> 
  Inset[Graphics[{Thick, Thick, Yellow, 
     Line[{{100, 100}, {166, 100}}], 
     Text[Style["10 \[Mu]", Yellow, Bold, 25], {120, 110}]}], 
   Scaled[{0.15, 0.9}]]]

The result is here:enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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