How to change the DPI of a photo in Salesforce Apex

You need a fast and easy implementation of photo DPI adjustment. That’s why you’re here, right? We’re going to have that sorted for you in a handful of minutes, just watch.

To kick things off, navigate to your Apex project folder. Into this folder, extract our API client. With that done, invoke convertImageImageSetDPI and input your desired DPI:

SwagConvertImageApi api = new SwagConvertImageApi();SwagClient client = api.getClient();// Configure API key authorization: ApikeyApiKeyAuth Apikey = (ApiKeyAuth) client.getAuthentication('Apikey');Apikey.setApiKey('YOUR API KEY');Map<String, Object> params = new Map<String, Object>{'dpi' => 56,'inputFile' => Blob.valueOf('Sample text file\nContents')};try {// cross your fingersBlob result = api.convertImageImageSetDPI(params);System.debug(result);} catch (Swagger.ApiException e) {// ...handle your exceptions}

Done! For all your image-related functionality, check out the rest of our APIs!

Image for post

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store