3
$\begingroup$

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

enter image description here

$\endgroup$
3
  • $\begingroup$ Have a look at this question $\endgroup$
    – cormullion
    Dec 11, 2012 at 12:38
  • $\begingroup$ Good, thanks! But how to avoid padding of croped image? $\endgroup$ Dec 11, 2012 at 12:50
  • 1
    $\begingroup$ Perhaps you could expand your question to include this information... This will also help to avoid this question being closed as a duplicate... $\endgroup$
    – cormullion
    Dec 11, 2012 at 13:28

2 Answers 2

2
$\begingroup$

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

img = ExampleData[{"TestImage", "Mandrill"}];
{dR, dC} = ImageDimensions[img];
Manipulate[
  Show[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).

$\endgroup$
2
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ that is a nice addition in 9. $\endgroup$ Dec 11, 2012 at 20:54
  • $\begingroup$ @Elfet Just out of curiosity - why the down vote? $\endgroup$ Dec 12, 2012 at 19:31

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.