Skip to content

An image processing pipeline API that automatically processes images, generates thumbnails, extracts metadata, and provides analysis through API endpoints

Notifications You must be signed in to change notification settings

yichingt/image_processing_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image_processing_api

This project is a FastAPI-based image processing pipeline API that automatically processes images, generates thumbnails, extracts metadata, and provides analysis through API endpoints.

Table of Contents

Project Overview/Structure

The Image Processing Pipeline API is a FastAPI-based application that automates the processing of uploaded images. It generates thumbnails, extracts metadata, and uses AI to caption images. The processed results are made available through RESTful API endpoints.

Key Features:

  • Image Upload: Accepts image uploads in JPG or PNG formats.
  • Metadata Extraction: Extracts basic metadata like dimensions, file format, and file size, and store them in memory.
  • In-Memory Storage: Stores processesed results in memory for quick retrieval.
  • Thumbnail Generator: Automatically generates small and medium sized thumbnails for each uploaded image.
  • AI-Powered Captioning: Uses the Blip Image Captioning by Salesforce

Process Flow

The flowchart below represents what happens when a file is uploaded using the API Process Flowchart Do refer to here for the processing pipeline documentation.

API Endpoints

Do refer to this section for the API endpoints documentation.

Technologies Used:

  • FastAPI: For building the pipeline API.
  • Uvicorn: For running the FastAPI server.
  • Pillow: Used for image processing and thumbnail generation.
  • Transformers: Used for the AI-powered image captioning.

Installation Steps

Follow the steps to set up the project on your local machine.

Pre-requisites

  • Python 3.8 or higher
    • To verify, enter python -V in CMD.
  • pip
  • Postman

Steps

  1. Clone this repository
git clone https://github.com/your-username/your-repo-name.git
cd repo-folder
  1. Install Dependencies
pip install -r requirements.txt
  1. Start the FastAPI server
  • Running in CMD:
cd repo-folder
python3 main.py
  • Runing in VSCode
Run with Debugger, choosing the options Python > FastAPI. 

🠪 The API will be available at http://localhost:8000 or http://127.0.0.1:8000

API Documentation

To view the API documentation, see here under Documentations folder.

Example Usage

All of these are done in Postman in this section:

🠪 Upload an Image

Send a POST request to /api/images with an image file to process it.

How To:

- In Postman, in the Body tab, for form-data input, include the **Key** as "file" and **Value* as an uploaded file in your local machine. uploading image success

🠪 Get All Processed Image Details

Send a GET request to /api/images to retrieve all images and their metadata details.

How To:

- In Postman, select the GET option, input the URL as shown and send the request. listing all images

🠪 Get a Specific Processed Image Details

Send a GET request to /api/images/{image_id} to retrieve that image's metadata details.

How To:

- In Postman, select the GET option, input the URL as shown and send the request. listing one image

🠪 Get Thumbnails

Send a GET request to **/api/images/{image_id}/thumbnails/{size} to retrieve a thumbnail (small or medium).

How To:

- In Postman, select the GET option, input the URL as shown and send the request. - Thumbnails request can be small or medium. gettnig thumbnal

Future Works

  • Creating a job queue for images coming in
  • Handle the images asynchronously
  • Dockerise the project

References/Credits:

About

An image processing pipeline API that automatically processes images, generates thumbnails, extracts metadata, and provides analysis through API endpoints

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages