0.1.0 • Published 2 years ago

@invertase/image-processing-api v0.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

Image Processing API Utilities

This package contains utilities for interacting with the Firebase Image Processing API Extension.

Installation

npm i --save @invertase/image-processing-api

Usage

builder

Returns a ImageProcessingApi instance which can be used to build an array of operations to be applied to an image via the extension.

import { builder } from '@invertase/image-processing-api';

const output = builder()
  // Input required
  .input({
    source: 'https://example.com/image.jpg',
  })
  .flip()
  .grayscale()
  .rotate({ angle: 90 })
  // Output required
  .output({
    format: 'png',
  });

Once created, the api provides the means to return the operations as JSON, a JSON string or an encoded JSON string suitable for GET requests in your browser.

const json = output.toJSON();
const jsonString = output.toJSONString();
const encodedJsonString = output.toEncodedJSONString();