Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to create Manipulator with Locator to take part of an image?

enter image description here

share|improve this question
Have a look at this question – cormullion Dec 11 '12 at 12:38
Good, thanks! But how to avoid padding of croped image? – Anton Medvedev Dec 11 '12 at 12:50
Perhaps you could expand your question to include this information... This will also help to avoid this question being closed as a duplicate... – cormullion Dec 11 '12 at 13:28
up vote 2 down vote accepted

One way that Manipulate[] can control the portion of the selected image with a locator is:

img = ExampleData[{"TestImage", "Mandrill"}];
{dR, dC} = ImageDimensions[img];
    ImageTake[img, {dR-50-p[[2]], dR+50-p[[2]]}, {p[[1]]-50,p[[1]] + 50}]], 
{{p, {dR/2, dC/2}}, Locator}]

This lets you scan around, zooming into the image. Control the size by the integers inside ImageTake[] (set to 50 here).

share|improve this answer

Of course, this is completely automatic in version 9. If we Import your image and just click on it, we get easy access to a crop tool, as well as others. It looks something like so:

enter image description here

Here's the cropped image:

enter image description here

share|improve this answer
that is a nice addition in 9. – Mike Honeychurch Dec 11 '12 at 20:54
@Elfet Just out of curiosity - why the down vote? – Mark McClure Dec 12 '12 at 19:31

Your Answer


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.