Run this command to install the SDK:

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


Or add this snippet to your package.json:

  "dependencies": {
    "cloudmersive-image-api-client": "^1.3.4"
  }


var CloudmersiveImageApiClient = require('cloudmersive-image-api-client');
var defaultClient = CloudmersiveImageApiClient.ApiClient.instance;

// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';



var apiInstance = new CloudmersiveImageApiClient.NsfwApi();

var imageFile = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // 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.nsfwClassify(imageFile, callback);

Run this command to install the SDK:

pip install cloudmersive-image-api-client


from __future__ import print_function
import time
import cloudmersive_image_api_client
from cloudmersive_image_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = cloudmersive_image_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'



# create an instance of the API class
api_instance = cloudmersive_image_api_client.NsfwApi(cloudmersive_image_api_client.ApiClient(configuration))
image_file = '/path/to/file' # file | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.

try:
    # Not safe for work (NSFW) content classification for Images
    api_response = api_instance.nsfw_classify(image_file)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling NsfwApi->nsfw_classify: %s\n" % e)

Run this command to install the SDK:

Install-Package Cloudmersive.APIClient.NET.ImageRecognition -Version 3.0.5


using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.ImageRecognition.Api;
using Cloudmersive.APIClient.NET.ImageRecognition.Client;
using Cloudmersive.APIClient.NET.ImageRecognition.Model;

namespace Example
{
    public class NsfwClassifyExample
    {
        public void main()
        {
            // Configure API key authorization: Apikey
            Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
            
            

            var apiInstance = new NsfwApi();
            var imageFile = new System.IO.FileStream("C:\\temp\\inputfile", System.IO.FileMode.Open); // System.IO.Stream | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.

            try
            {
                // Not safe for work (NSFW) content classification for Images
                NsfwResult result = apiInstance.NsfwClassify(imageFile);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling NsfwApi.NsfwClassify: " + e.Message );
            }
        }
    }
}

To install with Maven, add a reference to the repository in pom.xml:



And add a reference to the dependency in pom.xml:



To install with Gradle, add it in your root build.gradle at the end of repositories:



And add the dependency in build.gradle:



Run this command to install the SDK:

composer require cloudmersive/cloudmersive_imagerecognition_api_client


<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');



$apiInstance = new Swagger\Client\Api\NsfwApi(
    
    
    new GuzzleHttp\Client(),
    $config
);
$image_file = "/path/to/file"; // \SplFileObject | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.

try {
    $result = $apiInstance->nsfwClassify($image_file);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling NsfwApi->nsfwClassify: ', $e->getMessage(), PHP_EOL;
}
?>

Add the Objective-C client to your Podfile:

pod 'CloudmersiveImageRecognitionApiClient', '~> 1.0'


CMDefaultConfiguration *apiConfig = [CMDefaultConfiguration sharedConfig];

// Configure API key authorization: (authentication scheme: Apikey)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Apikey"];




NSURL* imageFile = [NSURL fileURLWithPath:@"/path/to/file"]; // Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.

CMNsfwApi*apiInstance = [[CMNsfwApi alloc] init];

// Not safe for work (NSFW) content classification for Images
[apiInstance nsfwClassifyWithImageFile:imageFile
          completionHandler: ^(CMNsfwResult* output, NSError* error) {
                        if (output) {
                            NSLog(@"%@", output);
                        }
                        if (error) {
                            NSLog(@"Error calling CMNsfwApi->nsfwClassify: %@", error);
                        }
                    }];

Add the Ruby client to your Gemfile:

gem 'cloudmersive-image-recognition-api-client', '~> 2.0.4'


# load the gem
require 'cloudmersive-image-recognition-api-client'
# setup authorization
CloudmersiveImageRecognitionApiClient.configure do |config|
  # Configure API key authorization: Apikey
  config.api_key['Apikey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['Apikey'] = 'Bearer'
end

api_instance = CloudmersiveImageRecognitionApiClient::NsfwApi.new

image_file = File.new('/path/to/inputfile') # File | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.


begin
  #Not safe for work (NSFW) content classification for Images
  result = api_instance.nsfw_classify(image_file)
  p result
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
  puts "Exception when calling NsfwApi->nsfw_classify: #{e}"
end

Download and copy the /client folder into your Apex project:

Download Apex Client

SwagNsfwApi api = new SwagNsfwApi();
SwagClient client = api.getClient();

// Configure API key authorization: Apikey
ApiKeyAuth 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 fingers
    SwagNsfwResult result = api.nsfwClassify(params);
    System.debug(result);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Install libcurl in your C/C++ project:

libcurl/7.75.0

This code snippet uses the built-in JavaScript XHR request capability


Walkthrough Video