Skip to content

abdulazizab2/ImageProcessingAPI

Repository files navigation

Introduction

The project spins up a local that does minimum image processing functionality. For now, it has only one feature which resizing and only handles jpg format images.

There are two routes only:

1- /api: Main page. No functionality, only a placeholder. 2- /api/images: More details in Usage Guide section

Installation

git clone https://github.com/abdulazizab2/ImageProcessingAPI.git
npm i package.json

Usage Guide {#How-To}

Spinning up the server

To spin up the server simply run:

npm run build && node dist/

A port 8000 will be exposed in your localhost. You can navigate to the available routes in the browser.

Resizing Images

Before trying to utilize the API functionality. Make sure to have an image in images directory with jpg extension then use this endpoint by either making a GET request from POSTMAN or pasting it in the browser or any method you prefer:

localhost:8000/api/images?filename=${IMAGE_NAME_WITHOUT_EXTENSION}&width=${NEW_WIDTH}&height=&{NEW_HEIGHT}

Note: ${} is a placeholder for a variable that you should replace with

IMAGE_NAME_WITHOUT_EXTENSION: Name of the image inside images directory without typing the extension

NEW_WIDTH: The width you'd like to resize your image to NEW_HEIGHT: The height you'd like to resize your image to

The resized image will be shown in the browser and it will be sized inside outputs directory

Notes

Notes on Unit Testing

As some unit tests test the functionality of saving images to disk. Using npm run test will remove all .jpg images inside outputs directory

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published