Python – Creating a croppable image field – How to store data for widgets?

Creating a croppable image field – How to store data for widgets?… here is a solution to the problem.

Creating a croppable image field – How to store data for widgets?

I would like to know how best to implement a croppable ImageField in Django.

Basically, I want to upload pictures and crop them. For example, use imagAreaSelect

The first method that came to mind was to create an ImageField and some metafields on my model to store the crop scale, width, and height I chosen.
But I wonder if there is a more concise way to fix this and encapsulate the clipping behavior further.

So ultimately I want to wrap the desired behavior in a widget.
Although the problem I see is that widgets often map to a single database field.

So I’m wondering if this is feasible and how best to save my image data?

Solution

We ended up creating a reusable image cropping app: django-image-cropping

Related Problems and Solutions