Shiyuan Duan
Shiyuan Duan

Reputation: 23

Crop or pad image using react and then upload to server

My web app built with react needs to upload images to a Django server. The upload process is okay except that the server expects square images. I know how to pad or crop the image using python on the server-side, but I feel it is better to do this kind of computations on the client-side. Could anyone points me to some image cropping, padding tools on react framework like PIL, numpy or cv2 in python.

Upvotes: 1

Views: 906

Answers (1)

Rahul Mahadik
Rahul Mahadik

Reputation: 1020

You can try the package, react-image-crop.

This can provide a UI that can crop the image as we want. You can review the code in the working example here.

Upvotes: 1

Related Questions