SimantovYousoufov / PyCrops

An image resizer/cropper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyCrops

An ImageCropping API

###What does PyCrops do? PyCrops will retrieve an image from the specified url, resize and, if requested, crop an image that it retrieves from a URL you specify to the dimensions you specify. It will then upload the altered file to an S3 bucket and return a url through which it can be accessed.

The live version can be accessed at http://pycrops-live.elasticbeanstalk.com/ using the same route configuration as local.

###Environment Setup Set up a virtual environment with the following dependencies:

###Application Set up

  • Fill in MySQL database information in CroppingService/settings.py
    • The database currently isn't being utilized but I have plans for how to use it to help with image cropping in the future.
  • From the root project directory run 'python manage.py migrate' to migrate the required Django tables to the database.
  • Create CroppingService/appinfo.py from appinfo_sample.py in the same folder and fill in the required information.
  • Start the local dev server with 'python manage.py runserver'. Navigating to http://localhost:8000/resize/1/*base64_encoded_request*/ will reach the API.

###Sending Requests The API accepts requests in a base64 encoded string. The string format is standardized and must be followed. Example:

<width desired>|<height desired>|<url of image to retrieve>
450|600|http://www.croscon.com/img/work-bpr/header.jpg

Encodes to:

NDUwfDYwMHxodHRwOi8vd3d3LmNyb3Njb24uY29tL2ltZy93b3JrLWJwci9oZWFkZXIuanBn

https://www.base64encode.org/ is useful for encoding sample requests.

The URL parameters are formatted: /resize/crop/base64_encoded_request/. Crop = 1 will crop the image from the center, any other value will just resize the image.

About

An image resizer/cropper


Languages

Language:Python 100.0%