This section will show you how to set up the Ameto client library, upload an asset to Ameto, create a processing pipeline, trigger a job, and retrieve the job result.
TIP
You need an API key to try out the examples. If you haven't done it already, register a free account and create an API key.
Using Maven or Gradle (requires Java 8 or higher):
// Initialize the client library
Ameto ameto = new Ameto("https://api.ameto.de", "<your API token>");
// Create a pipeline consisting of a single step that returns an optimized JPEG image
Pipeline pipeline = ameto.addPipeline("convertToJpeg")
.format(Pipeline.Format.Jpeg)
.build();
Path image = Paths.get("<path/to/image.png>");
Asset asset = ameto.add(image); // Retrieve an asset from the file
ProcessedAsset result = pipeline.push(asset); // Trigger a job
Path outputPath = Paths.get("<path/to/result.jpeg>");
Files.copy(result.getEssence(), outputPath); // Write the result to your disk
Ameto is built on three fundamental concepts: assets, pipelines, and jobs.
Assets are arbitrary binary data that are valuable to you. Your company logo is an asset, for example. Once uploaded, an asset will be archived until it is explicitly deleted.
A pipeline is a sequence of processing steps. A "create thumbnail" pipeline, for instance, might resize and sharpen an image. Pipelines accept assets and create processed assets. All pipeline steps are non-destructive, meaning they do not modify the asset. A new asset is created instead.
Once an asset is "pushed" into a pipeline, a job is triggered that performs the processing steps defined by the pipeline. The example code on the right does exaclty that.