Image Processing API
Made by Invertase
Use this extension to optimize and transform images via a powerful HTTP API with over 30 different image operations to enhance and manipulate your images.
- Works with
- Cloud Storage
- Version
- 0.2.1 | Source code
- License
- Apache-2.0
- Publisher
- Invertase
- Report
- Bug
- Abuse
How this extension works
Image Processing Extension
Use this extension to optimize and transform images via a powerful HTTP API with over 30 image operations for enhancing and manipulating your images.
How It Works
When you install this extension, it deploys a Cloud Function that exposes an HTTP API. All requests must be sent to the /process endpoint of the function. You perform image operations by passing an operations query parameter—a URL-encoded JSON string defining the operations to execute.
Example
Define your operations like so:
const operations = [
{
operation: 'input',
type: 'url',
url: 'https://example.com/image.jpg',
},
{
operation: 'grayscale',
},
{
operation: 'output',
format: 'webp',
},
];
const params = `?operations=${encodeURIComponent(JSON.stringify(operations))}`;
Then, make your GET request to your Cloud Function using the correct endpoint. For example:
https://<your-configured-region>-<your-project-id>.cloudfunctions.net/<extension-instance-id>/process${params}
The extension also comes with a JavaScript utility library for simplifying the creation of operations:
import { builder } from '@invertase/image-processing-api';
const output = builder()
.input({
url: 'https://example.com/image.jpg',
})
.grayscale()
.output({
format: 'webp',
});
const params = `?operations=${output.toEncodedJSONString()}`;
View the official documentation for full usage examples.
Relative paths
The extension provides a hostname parameter, allowing you to query the function with local paths (starting with /
).
As an example, if we set the hostname parameter to “example.com” then the following operation:
const operations = [
{
operation: 'input',
type: 'url',
url: '/image.jpg',
},
{
operation: 'grayscale',
},
{
operation: 'output',
format: 'webp',
},
];
is equivalent to the earlier given example. The url https://example.com/image.jpg
is constructed within the extension.
Note that this will only apply to paths that begin with a forward slash /
, and only when the hostname parameter is set.
Additional setup
Before installing this extension, make sure that you’ve set up a Cloud Storage bucket in your Firebase project.
Billing
To install an extension, your project must be on the Blaze (pay as you go) plan
- You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
- This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s no-cost tier:
- Cloud Storage
- Cloud Functions (Node.js 10+ runtime. See FAQs)