Skip to content

This Node.js project implements an on-the-fly image optimization service. It allows users to upload images, which are then resized, converted to different formats (such as JPEG, PNG, or WebP), and optimized for quality. The service also includes caching to improve performance by storing optimized images temporarily.

Notifications You must be signed in to change notification settings

omjadhav2507/image-optimization-service

Repository files navigation

Image Optimization Service

This project provides a Node.js-based image optimization service that allows users to upload images and receive optimized versions in different formats and sizes.

Features

  • Resizing: Adjust the dimensions of images.
  • Compression: Reduce the file size of images while maintaining quality.
  • Format Conversion: Convert images to different formats (JPEG, PNG, WebP).
  • Caching: Cache optimized images to improve performance.
  • Security: Basic authentication and security headers.
  • Rate Limiting: Prevent abuse by limiting the number of requests.
  • Logging: Comprehensive logging for monitoring and debugging.
  • Error Handling: Centralized error handling for better reliability.

Installation

To run this project locally, follow these steps:

  1. Clone the repository:
    git clone https://github.com/your-username/image-optimization-service.git
    cd image-optimization-service
    
  2. Install dependencies: npm install

3.Start the server: node server.js

Usage

Uploading an Image Use tools like curl or Postman to upload an image and receive an optimized version: curl -F "image=@/path/to/your/image.jpg" "http://localhost:3000/optimize?format=webp&width=800&quality=80" --output optimized_image.webp

Parameters format: Desired image format (jpeg, png, webp). width: Desired width of the optimized image (default: 800). quality: Desired quality of the optimized image (default: 80).

About

This Node.js project implements an on-the-fly image optimization service. It allows users to upload images, which are then resized, converted to different formats (such as JPEG, PNG, or WebP), and optimized for quality. The service also includes caching to improve performance by storing optimized images temporarily.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published