How to programmatically create ImageCropperValue with local media

The documentation for Image Cropper says “If the Image Cropper is used on a Document Type, the file and crops will be local to the Document.” Is there a way to programmatically accomplish this? Storing an image locally to the Document and setting an ImageCropperValue property?

I can’t find any documentation on how to store media locally on a document.

I basically need to programmatically accomplish the same process that Image Cropper does when used from Content.


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/114293-how-to-programmatically-create-imagecroppervalue-with-local-media