2. Compression OptimizeImages allows you to compress images in 3 different ways that are by uploading a file, through a URL or a crawler image that is still available on the server. 2.1 File Compression: To optimize files you must make a POST request encoded as "multipart/form-data" to make this request and upload the file in the "file" parameter. Parameters: - file: binary - File to optimize
- convertionFormats: string - JSON Array of convertion formats, ex: ["avif", "webp"]
- compressionFormats: string - Formats available to compress, ex: ["png", "jpg", "svg", "gif"]
- optimizationLevel: string - Compression level, ex: recommended
2.2 Crawler Compression: This endpoint allows you to optimize and convert images previously obtained in the scanner, therefore before using this endpoint it is necessary to do an analysis using the crawler endpoint since the images will remain on the server for a duration of 3 hours, which will allow the conversion and compression. Parameters: - website: string - Website URL, ex: https://www.artify.co
- convertionFormats: array - Array of convertion formats, ex: ["avif", "webp"]
- compressionFormats: array - Formats available to compress, ex: ["png", "jpg", "svg", "gif"]
- optimizationLevel: string - Compression level, ex: recommended
2.3 URL Compression: This endpoint allows you to compress and convert with just the URL of an image. Parameters: - URL: string - image URL to use, ex: https://www.artify.co
- convertionFormats: array - Array of convertion formats, ex: ["avif", "webp"]
- compressionFormats: array - Formats available to compress, ex: ["png", "jpg", "svg", "gif"]
- optimizationLevel: string - Compression level, ex: recommended
Body response: You will have all the information of the compressed file in an object as a response, which includes information of the file such as name, extension, compression data such as bytes, compressed percentage, original size, compressed size, difference between bytes and download url.
2.4 Zip download: This endpoint allows you to download a ZIP with multiple images that you have optimized. Parameters: -
images: array - image data to compress ex: [{name: "tree_267376982.jpg", file: "2302fc14-88fd-43d3-a1db-bfcccda9a616-recommended.jpg"}]