This is a simple Python application that accepts image URLs, creates thumbnails, and serves the resized images using Flask.
Follow these steps to set up the project on your local environment:
-
Clone the project repository:
git clone https://github.com/elisalimli/python-image-resizer.git
-
Navigate to the project's folder:
cd python-image-resizer
-
Make sure you have Python 3 installed on your system.
-
Install the required packages:
pip install -r requirements.txt
To run the program, execute the following command:
python3 image_resizer.py
This will start the Flask application, and you'll be able to access it through your web browser or by making HTTP requests.
Alternatively, you can use Docker to run the application in a container. Follow these steps:
-
Build the docker image:
docker build -t image-resizer .
-
Run the docker container:
docker run --rm -it -p 4000:4000 image-resizer
This will build the image and run the application within a Docker container. The application will be accessible at http://localhost:4000.
After running the application, you can use a tool like curl to make HTTP requests to the endpoints and test the image resizing functionality.
For example, to create a thumbnail of an image, use the following command:
curl -X GET "http://localhost:4000/?size=256&url=http://example.com/"