This project provides a Docker Compose setup for running an ImageMagick service alongside a Flask API wrapper. The API allows you to process images using ImageMagick through HTTP requests.
imagemagick-docker/
├── docker-compose.yml
├── images/
│ └── (this folder will hold your input and output images)
├── scripts/
│ └── imagemagick_api.py
└── README.md
- Docker and Docker Compose installed on your machine.
- Basic knowledge of how to use Docker commands.
-
Clone the Repository:
git clone https://github.com/yourusername/imagemagick-docker.git cd imagemagick-docker -
Set Up the Project: Create the
imagesdirectory for input and output images:mkdir images
-
Run the Docker Compose: Start the services by running:
docker-compose up -d
-
Access the API: The API will be available at
http://localhost:5000/process-image. You can use this endpoint to process images. -
Sending Requests: To process an image, send a POST request with JSON data. Here’s an example using
curl:curl -X POST http://localhost:5000/process-image \ -H "Content-Type: application/json" \ -d '{\ "supplied_image": "/images/input_image.png",\ "text": "Your Custom Text Here",\ "font_size": 80\ }'
Ensure
input_image.pngexists in theimagesfolder (it is mounted as/imagesin the container). -
Check Output: After processing, the output image will be saved in the
imagesdirectory with a name likefinal_output_<pid>.jpg. This avoids filename collisions when multiple requests run at the same time.
To stop the services, run:
docker-compose downThis project is licensed under the MIT License.
I’m Jon Munson - I like building simple things that solve real problems.
Your support helps me keep shipping: maintaining repos, fixing bugs, and adding features.
Buy me a coffee
More about me:
Website
|
@jonmunson
|
LinkedIn