SDKs overview
Serialif Color offers Software Development Kits (SDKs) to facilitate integration with its Color API. These SDKs are designed to abstract the complexities of direct HTTP requests, enabling developers to incorporate automated color correction and image enhancement capabilities into their applications using familiar programming languages. The primary focus of these SDKs is to simplify tasks such as image upload, processing parameter configuration, and retrieval of enhanced images, supporting various image formats for processing (Serialif Color API documentation).
The availability of official SDKs in popular languages aims to reduce development time and potential errors associated with manual API interaction. Developers can utilize these tools for batch processing, e-commerce product image workflows, and integrating real-time color adjustments into web and desktop applications. Community-contributed libraries may also extend support to additional languages or specific frameworks.
Official SDKs by language
Serialif Color provides official SDKs to streamline the integration process for developers. These SDKs are maintained by Serialif and are recommended for stable and supported access to the Color API. The official SDKs abstract the underlying RESTful API calls, handling authentication, request formatting, and response parsing, which allows developers to focus on application logic rather than HTTP specifics (Serialif Color developer documentation).
The following table outlines the key official SDKs available, detailing their respective programming languages, package names, and typical installation commands. These SDKs are designed to provide a consistent interface for interacting with the Serialif Color API, ensuring compatibility and access to the latest features.
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| Python | serialif-color-sdk |
pip install serialif-color-sdk |
Stable |
| Node.js | @serialif/color-sdk |
npm install @serialif/color-sdk |
Stable |
| PHP | serialif/color-sdk |
composer require serialif/color-sdk |
Stable |
Installation
Installing Serialif Color SDKs involves using standard package managers specific to each programming language. Before installation, developers typically need to ensure they have the correct runtime environment and package manager configured. For example, Python projects require pip, Node.js projects use npm or yarn, and PHP projects rely on Composer.
Python
To install the Python SDK, ensure you have Python 3.x and pip installed. Open your terminal or command prompt and execute the following command:
pip install serialif-color-sdk
This command fetches the latest version of the serialif-color-sdk package from the Python Package Index (PyPI) and installs it into your environment (Python pip installation guide).
Node.js
For Node.js environments, you can use npm (Node Package Manager) or yarn. Ensure you have Node.js and npm/yarn installed. Run the following in your project directory:
npm install @serialif/color-sdk
Alternatively, with Yarn:
yarn add @serialif/color-sdk
These commands add the Serialif Color SDK to your project's node_modules directory and update your package.json file (npm install command reference).
PHP
PHP projects typically use Composer for dependency management. If Composer is not installed, you can find installation instructions on the official Composer website. Once Composer is ready, navigate to your project's root directory in the terminal and execute:
composer require serialif/color-sdk
This command downloads the Serialif Color SDK and its dependencies, adding them to your project's vendor directory and updating composer.json and composer.lock files (Composer installation guide).
Quickstart example
This quickstart example demonstrates how to use the Serialif Color Python SDK to upload an image, apply a basic color correction, and retrieve the processed image. This example assumes you have installed the Python SDK and have a valid API key from your Serialif Color account (Serialif Color API quickstart guide).
Python Quickstart
First, ensure your API key is available. You can set it as an environment variable or pass it directly to the SDK client. For security and best practice, using environment variables is recommended.
import os
from serialif_color_sdk import SerialifColorClient
# Replace with your actual API Key or set as an environment variable
API_KEY = os.getenv('SERIALIF_COLOR_API_KEY', 'YOUR_API_KEY_HERE')
client = SerialifColorClient(api_key=API_KEY)
# Path to your image file
image_path = 'path/to/your/image.jpg'
output_path = 'path/to/save/processed_image.jpg'
try:
# Upload image and apply default color correction
# The 'profile' parameter can be customized (e.g., 'ecommerce', 'portrait', 'vibrant')
# Refer to the Serialif Color API reference for available profiles and options.
print(f"Processing image: {image_path}")
processed_image_data = client.process_image(
file_path=image_path,
profile='default' # Example profile
)
# Save the processed image
with open(output_path, 'wb') as f:
f.write(processed_image_data)
print(f"Processed image saved to: {output_path}")
except Exception as e:
print(f"An error occurred: {e}")
This Python script initializes the SerialifColorClient with your API key. It then calls the process_image method, passing the local path to the input image and specifying a color correction profile. The processed image data, returned as bytes, is then saved to a new file. Developers can explore the Serialif Color API reference for a complete list of callable methods, customization options, and supported parameters (Serialif Color API reference).
Node.js Quickstart
This Node.js example demonstrates how to use the @serialif/color-sdk to upload an image and apply a color correction profile.
const SerialifColorClient = require('@serialif/color-sdk');
const fs = require('fs');
const path = require('path');
// Replace with your actual API Key or set as an environment variable
const API_KEY = process.env.SERIALIF_COLOR_API_KEY || 'YOUR_API_KEY_HERE';
const client = new SerialifColorClient(API_KEY);
const imagePath = path.join(__dirname, 'path/to/your/image.jpg');
const outputPath = path.join(__dirname, 'path/to/save/processed_image.jpg');
async function processMyImage() {
try {
console.log(`Processing image: ${imagePath}`);
const processedImageData = await client.processImage({
filePath: imagePath,
profile: 'default' // Example profile
});
fs.writeFileSync(outputPath, processedImageData);
console.log(`Processed image saved to: ${outputPath}`);
} catch (error) {
console.error(`An error occurred: ${error.message}`);
}
}
processMyImage();
PHP Quickstart
This PHP example illustrates how to use the serialif/color-sdk to send an image for processing and save the result.
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Serialif\ColorSdk\SerialifColorClient;
// Replace with your actual API Key or set as an environment variable
$apiKey = getenv('SERIALIF_COLOR_API_KEY') ?: 'YOUR_API_KEY_HERE';
$client = new SerialifColorClient($apiKey);
$imagePath = __DIR__ . '/path/to/your/image.jpg';
$outputPath = __DIR__ . '/path/to/save/processed_image.jpg';
try {
echo "Processing image: " . $imagePath . "\n";
$processedImageData = $client->processImage([
'filePath' => $imagePath,
'profile' => 'default' // Example profile
]);
file_put_contents($outputPath, $processedImageData);
echo "Processed image saved to: " . $outputPath . "\n";
} catch (\Exception $e) {
echo "An error occurred: " . $e->getMessage() . "\n";
}
?>
Community libraries
While Serialif Color provides official SDKs for Python, Node.js, and PHP, the open-source nature of many development ecosystems often leads to the creation of community-contributed libraries. These libraries, developed and maintained by the developer community, can offer support for additional programming languages, frameworks, or specialized use cases not covered by the official SDKs (Serialif Color developer resources).
Community libraries for Serialif Color can range from simple wrappers around the REST API to more complex integrations with specific image processing pipelines or content management systems. Developers often create these libraries to match their preferred development stacks or to solve specific integration challenges within their projects. While community-maintained projects may offer flexibility and wider language support, developers should evaluate their stability, maintenance status, and adherence to the official API specifications before incorporating them into production systems.
For example, a developer might create a Go or Ruby wrapper if those are their primary development languages, or a library specifically designed to integrate Serialif Color with a popular web framework like React or Laravel. When considering a community library, it is advisable to check its documentation, the activity of its maintainers, and its license to ensure it meets project requirements. The official Serialif Color documentation serves as the authoritative source for the API's behavior and capabilities, which any community library should adhere to (Serialif Color API reference documentation).