How-Tos

Convert images to JPEG

  1. Ensure you have an Ameto API key. If you do not have an API key yet, create a free account to get one.

  2. Initialize the ameto client

Ameto ameto = new Ameto("https://api.ameto.de", "<your API key>");
  1. Create a pipeline specifying Jpeg as output format
Pipeline jpegPipeline = ameto.add("convertToJpeg")
                             .format(Pipeline.Format.Jpeg)
                             .build();
  1. Upload one or more assets
Path pathToAsset = Paths.get("<path/to/image.png>");
Asset asset = ameto.add(pathToAsset);
  1. Trigger a pipeline job by pushing an uploaded asset through the pipeline
ProcessedAsset jpegImage = jpegPipeline.push(asset);
  1. Write the JPEG to your disk
Path pathToJpeg = Paths.get("<path/to/image.jpeg");
Files.copy(jpegImage.getEssence(), pathToJpeg);

Create images for a responsive Website

  1. Ensure you have an Ameto API key. If you do not have an API key yet, create a free account to get one.

  2. Initialize the ameto client

Ameto ameto = new Ameto("https://api.ameto.de", "<your API key>");
  1. Create a pipeline for each breakpoint in you layout. The pipeline should automatically rotate images and resize them accordingly.
Pipeline pipeline_800_600 = ameto.add("image-800x600")
                             .autoOrient()
                             .resize(800, 600)
                             .format(Pipeline.Format.Jpeg)
                             .build();
  1. Upload one or more assets
Path pathToAsset = Paths.get("<path/to/image.jpeg>");
Asset asset = ameto.add(pathToAsset);
  1. Trigger a pipeline job by pushing an uploaded asset through the pipeline
ProcessedAsset image_800_600 = pipeline_800_600.push(asset);
  1. Write the JPEG to your disk
Path pathToJpeg = Paths.get("<path/to/image.jpeg");
Files.copy(image_800_600.getEssence(), pathToJpeg);