Skip to content

jonmunson/imagemagick-api-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ImageMagick Docker Setup with Flask API

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.

Project Structure

imagemagick-docker/
├── docker-compose.yml
├── images/
│   └── (this folder will hold your input and output images)
├── scripts/
│   └── imagemagick_api.py
└── README.md

Prerequisites

  • Docker and Docker Compose installed on your machine.
  • Basic knowledge of how to use Docker commands.

Getting Started

  1. Clone the Repository:

    git clone https://github.com/yourusername/imagemagick-docker.git
    cd imagemagick-docker
  2. Set Up the Project: Create the images directory for input and output images:

    mkdir images
  3. Run the Docker Compose: Start the services by running:

    docker-compose up -d
  4. Access the API: The API will be available at http://localhost:5000/process-image. You can use this endpoint to process images.

  5. 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.png exists in the images folder (it is mounted as /images in the container).

  6. Check Output: After processing, the output image will be saved in the images directory with a name like final_output_<pid>.jpg. This avoids filename collisions when multiple requests run at the same time.

Stopping the Services

To stop the services, run:

docker-compose down

License

This project is licensed under the MIT License.

Who made this?

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  Buy me a coffee

More about me:   Website   |    @jonmunson   |    LinkedIn


About

REST API that wraps around ImageMagick, providing an endpoint that services can call to trigger image processing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages