Skip to main content

Getting started

A quick guide on how to easily get started with the PhotoEditor SDK for server. Your kick-off to delight your users with top-notch editing capabilities.

Install required dependencies via platform package manager

Free Trial#

Our tech is modified to be used for testing purposes without a license key. To start testing just follow this Get Started guide and leave out the step of entering the commercial license keys. The editor will simply render a watermark over the preview and final results. And in case you need any technical assistance, make sure to reach out to us: https://img.ly/support. We’ll be glad to help.

Mac OSX#

shell
$ xcode-select --install
$ brew install libtiff jpeg libpng cairo libsvg librsvg giflib pango node

Ubuntu#

shell
$ sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++

Install the latest release via npm:

bash
# Install PhotoEditorSDK Server/Node
npm install photoeditorsdk-server
# or
npm install -s git+https://git@github.com/imgly/pesdk-server-build.git

The npm package comes with the Server SDK and all its assets included. Depending on your setup, you need to copy the asset folder from the npm package to any folder that is accessible to your code (e.g. assets).

bash
cp -r node_modules/photoeditorsdk-server/assets assets

Next, the sdk needs to be loaded and initialized:

JavaScript
const PesdkServer = require('photoeditorsdk-server'); // require the sdk
const pesdkServer = new PesdkServer({
license: 'YOUR_LICENSE', // <-- Please replace this with your license. Please make sure this is in *string* format, not *object*.
editor: {
preferredRenderer: 'webgl', // or 'canvas'
export: {
format: 'image/jpeg',
type: PesdkServer.SDK.RenderType.BUFFER,
},
},
assets: {
baseUrl: '../node_modules/photoeditorsdk-server/assets', // <-- This should be the absolute path to your `assets` directory
},
});
// example that converts the image to black and white
const configuration = {
version: '3.0.0',
operations: [
{
type: 'filter',
options: {
intensity: 1,
identifier: 'imgly_lut_bw',
},
},
],
};
/** Variant 1: Load image data and call PesdkServer#setImage directly * */
const result = PesdkServer.ImageLoader.load('URI TO INPUT IMAGE').then(
inputImage => {
pesdkServer.setImage(inputImage);
pesdkServer.render(configuration); // Apply the serialization to the input image
},
);
/** Variant 2: Update image uri in serialization file * */
// serialization.image |= {}
// serialization.image.uri = 'URI TO INPUT IMAGE'
// const result = pesdkServer.render(serialization) // Apply the serialization to the input image
// Finally wait for the promise to be resolved and process the resulting output image buffer
result
.then(outputImageBuffer => {
// do Something with the image data. e.g. write to file
console.log('Done!');
})
.catch(e => {
console.log(e);
});

Starting here you can use the SDK in any NodeJS application. For more examples please take a look at the examples directory in our GitHub repository.