Mathematica now includes support for fairly involved interactive manipulation of displayed graphics, which includes cropping (ctrl-drag). Is there some way to get the crop dimensions set by the user, so that they can be read out dynamically?
Alternatively, is there a way to disable the Drawing Tools cropping and replace this ctrl-drag cropping behavior with a custom implementation? What I'm after are the actual dispayed pixel coordinates in image space.
The following code allows region-of-interest selection using row/column selection:
DynamicModule[{img, w, h},
img = ExampleData[{"TestImage", "Lena"}];
{w, h} = ImageDimensions@img;
Manipulate[
Labeled[ImageAdjust@ImageTake[img, {row1, row2}, {col1, col2}],
ToString[{{row1, row2}, {col1, col2}}], Top], {{row1, 1}, 1, row2,
1}, {{row2, w}, row1 + 1, w, 1}, {col1, 1, col2, 1}, {{col2, h},
col1 + 1, h, 1}]]
It would be nice to be able to read in the crop coordinates here and make the display behave consistently when ctrl-drag is used to crop the image drawn by Manipulate
.
Possibly helpful related question: 5568