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
- Host: GitHub
- URL: https://github.com/devenes/image-resizing-service
- Owner: devenes
- License: mit
- Created: 2022-05-25T21:54:19.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-11T23:54:27.000Z (over 3 years ago)
- Last Synced: 2025-06-15T00:05:44.580Z (7 months ago)
- Topics: api, flask, get, post, python
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Image Resizing Service
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