# Locator position as argument in ImageTrim

I want to create a snippet that shows an image with two locators, and side-by-side with its crop based upon the position of the locators. Here is what I wrote. But it gives error that the list of locator positions "is not valid region of interest."

How can I solve this error? And is there other simple way of realizing what I want?

img = Import["ExampleData/spikey.tiff"];
DynamicModule[{pts = {{1, 1}, {100, 100}}},
{LocatorPane[Dynamic[pts],img],ImageTrim[img,Dynamic[pts]]}]


Put Dynamic outside ImageTrim:
img = Import["ExampleData/spikey.tiff"];

• Because Dynamic does its work entirely in the front end, you cannot use it inside functions that need to access the value of an expression in order to do their work.
• Dynamic is a formatting function that does its work in the front end, not in the kernel, so if it is used in a way where it will never be placed as output, it is probably a mistake.