Is there a way to trigger an image crop dynamically? I have a Flag setup for an image content type which allows users to Flag an image that they want to be their avatar/user picture. I also have a View which displays this flagged image.

When a user clicks this Flag I would like to be able to trigger a crop (where the user is able to select the cropping area manually) so that a copy of the image can be made and referenced in a separate avatar gallery, without effecting the original image which will stay in it's gallery uncropped. There are several cropping solutions for Drupal 7 however is there a way that cropping can be triggered dynamically as in my example, perhaps via Rules or another way?
A module that you want to start looking at is Imagefield Crop. Details from project page:


  When the user uploads an image it is presented inside a cropping area. A cropping box is shown inside, and the user can resize and move it. Upon clicking "preview" or "submit", the image is cropped and the result is saved instead of the original image.
  
  Features
  - Seamless, intuitive cropping, almost like using a desktop photo editing app
  - All major browsers supported
  - Dynamic preview - you see how your crop will look like, in real time!
  - Original image is saved for recropping.
  - No matter what resolution the cropping area is, the original image is used for cropping (for highest quality)
  - The sizes of the cropping area, cropping box and resulting image can be controlled by the administrator


The problem with using this module however is that it only works with the imagefield module and the user picture.

If you already have a bunch of users that uploaded avatars using Drupal's core functionality then it would be best to rip the ImageField Crop module apart and see how it can be integrated into Drupal's user avatars.

If you have yet to have any users upload avatars then you can follow these steps.... 


Create a user field called "Pic" and use the "Image with cropping" widget on it. 
When the user flags the image, you can redirect to the user edit page while passing the fid of the flagged image.
After that you can use hook_form_alter to chuck in the fid, uri and fileurl from the passed fid as the '#default_value' of the newly created "Pic" field from step 1.


The annoying thing about this solution is that you will have to modify user-picture.tpl.php to use your custom created field over the default avatar picture.