How to remove EXIF data from an image file in Salesforce Apex

Removing EXIF data is an important procedure, but can also be a very difficult one in Apex. Today’s post covers how to avoid this difficulty and get this functionality into your project almost instantly. Let’s get straight to the process.

To begin, we will need to install the client for the API that we are going to be using. Download this here:

Extract the client folder right into your project, then call this function as you see here:

SwagEditApi api = new SwagEditApi();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>{'imageFile' => Blob.valueOf('Sample text file\nContents')};try {// cross your fingersBlob result = api.editRemoveExifData(params);System.debug(result);} catch (Swagger.ApiException e) {// ...handle your exceptions}

And you are done! Talk about simple.

Image for post
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