An open API service indexing awesome lists of open source software.

https://github.com/devenes/image-resizing-service

A simple image resizing service accepts HTTP GET or POST, with two parameters
https://github.com/devenes/image-resizing-service

api flask get post python

Last synced: 5 months ago
JSON representation

A simple image resizing service accepts HTTP GET or POST, with two parameters

Awesome Lists containing this project

README

          

Image Resizing Service


Github top language
Github language count
Repository size
License




About   |  
Technologies   |  
Requirements   |  
Starting   |  
License   |  
Author


## :dart: About

A simple image resizing service accepts HTTP GET or POST, with two parameters:

- urlBase64: Base64 encoded URL
- size: size of a square bounding box, in pixels
Returns the resized image, or an image of the original size if size is less than the original size

## :rocket: Technologies

The following tools were used in this project:

- [Python](https://www.python.org/)
- [gunicorn](https://gunicorn.org/)
- [Flask](https://flask.palletsprojects.com/)
- [Pillow](https://pillow.readthedocs.io/)

## :white_check_mark: Requirements

Before starting :checkered_flag:, you need to have [Git](https://git-scm.com) and [Python](https://www.python.org/) installed.

## :checkered_flag: Starting

```bash
# Clone this project
git clone https://github.com/devenes/image-resizing-service
```

```bash
# Access
cd image-resizing-service
```

```bash
# Install dependencies
pip install -r requirements.txt
```

```bash
# Run the service
python image_resizer.py
```

- Try it out locally (see note below on dependencies)

```bash
# Get a base64 encoded version of an image URL:
echo -n "http://storage.googleapis.com/myBucketName/Image_Name.jpg" | base64
# Use curl to access the service, providing that base64 encoded URL value:
time curl http://localhost:18080/?size=800&urlBase64=aHR0cDovL3N0b3J...bi5qcGc= > output.jpg
```

- Installation of dependencies, for running locally (Ubuntu)

```bash
sudo apt-get build-dep python-imaging
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
sudo apt-get install python-pip
sudo pip install Pillow
```

- Run the service in a Docker container

```bash
docker run --rm -i -t -d -p 8080:18080 image/name
```

- Run on Cloud

```bash
# Edit ./manifest.yml to suit your application
cf push
cf open
```

## :memo: License

This project is under license from MIT. For more details, see the [LICENSE](LICENSE.md) file.

Made with :heart: by devenes

 

Back to top