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.

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? –  Elfet Dec 11 '12 at 12:50
1  
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
add comment

2 Answers

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];
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).

share|improve this answer
add comment

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
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.