How to emboss an image in Node.JS

Cloudmersive
2 min readApr 5, 2020

Embossing an image can really improve the sense of style that the image projects. But how can we apply this effect without resorting to time consuming Photoshop batching or writing out our own embossing algorithm? Well don’t fret, we have an API for that.

Installation is how we begin the process. Set up our API client with npm install, via this command.

npm install cloudmersive-image-api-client --save

Now call the emboss function, shown below. We can customize our image effect by setting the sigma and radius of the emboss filter.

var CloudmersiveImageApiClient = require('cloudmersive-image-api-client');var defaultClient = CloudmersiveImageApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveImageApiClient.FilterApi();var radius = 56; // Number | Radius in pixels of the emboss operation; a larger radius will produce a greater effectvar sigma = 56; // Number | Sigma, or variance, of the emboss operationvar imageFile = "/path/to/file"; // File | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.filterEmboss(radius, sigma, imageFile, callback);

And it’s just as easy as that!

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.