Experimenting with the IMG Processing SDK
In the last article, we saw how to get started with the IMG Processing API. It is a nice abstract alternative to interact with IMG Processing, a powerful and flexible API and Node.js SDK that provides a wide range of image manipulation and analysis capabilities.
Presenting IMG Processing
Presenting IMG Processing - In a world of digital media, it is increasingly common to transmit information through images instead of words.
Today, I would like to share with you how to use the node-sdk.
img-processing-sdk
img-processing-sdk - SDK for image processing. Latest version: 1.0.0. Start using img-processing-sdk in your project by running `npm i img-processing-sdk`.
Getting Started
A Software Development Kit (SDK) makes the integration of the library into Node.js-based projects easier. This way, with the API key and an intuitive API, you are able to interact with IMG Processing without internal complications like handling HTTP requests and responses, parsing, etc.
Let’s stop talking and see it in action. First, install the SDK.
npm install img-processing-sdk
This library gives us 3 main classes: IMGProcessingClient, ImageObject, and IMGProcessingAPIError. First, let’s initialize the client with our API key:
import { IMGProcessingClient } from 'img-processing-sdk';
const client = new IMGProcessingClient({
apiKey: process.env.IMG_PROCESSING_API_KEY,
});
This gives us an IMGProcessingClient object, the main class of the IMG Processing SDK. It is a wrapper around http requests to the IMG Processing API, providing a simple and easy-to-use way to interact with the API. You can check the available methods in the documentation:
IMGProcessingClient - IMG Processing
Simple and easy-to-use way to interact with the IMG Processing API
Exploring the SDK
Once you have initialized the client, you can start interacting with the API using the same methods of the specification. For example, let’s upload an image from our file system:
const image = await client.uploadImage({
image: 'path/to/image.jpg',
name: 'image.jpg',
});
Once we have uploaded the image, the method returns an ImageObject. It represents an image processed using the IMG Processing API. The object contains information about the image, such as its URL, size, and format, like the following:
{
"id": "image_b3wfdnk9gjx442a6deayfh17",
"name": "image.jpg",
"url": null,
"width": 700,
"height": 320,
"format": "jpeg",
"size": 27696,
"created_at": "2024-09-22T16:00:29.700Z"
}
In addition to these read-only properties, the object contains many methods that you can review in the documentation:
ImageObject - IMG Processing
Base class for all image objects
For example, let’s convert the image to PNG:
const pngImage = await image.convert({
format: "png",
});
Now we got the converted PNG image:
{
"id": "image_jwlx4c3p2djgrdrwrja23i74",
"name": "image.jpg",
"url": null,
"width": 700,
"height": 320,
"format": "png",
"size": 62504,
"created_at": "2024-09-22T16:04:14.078Z"
}
That’s it; we converted the image from JPEG to PNG with no complexities. If you want to store the result, download the image and save it in the filesystem:
const blob = await pngImage.download();
The Next Steps
IMG Processing is still on a release candidate stage, so there could be some random errors that I’m still trying to find through intensive automated testing.
If you find any error, you can create an issue in the GitHub repository:
GitHub - img-processing/node-sdk
Contribute to img-processing/node-sdk development by creating an account on GitHub.
During the next posts, I will tell you more about these changes and keep you updated about the achievements and problems I encounter during this new journey. In the meantime, keep experimenting and creating amazing things!
If you enjoy the content, please don’t hesitate to subscribe and leave a comment! I would love to connect with you and hear your thoughts on the topics I cover.
You might also like

Presenting IMG Processing
Discover what happened in September 2024. This month features the launch of IMG Processing, a powerful API and SDK for image manipulation and analysis.

How to Speed Up a Heavy Web App
Discover what happened in April 2025. This month features a deep dive into optimizing heavy web apps using Web Workers, WebP, OPFS, and more.

Presenting Scan Documents
Discover what happened in March 2025. This month features the launch of Scan Documents, an app to solve personal archiving problems.