▫️Image Format Converter

/es5-es6

This endpoint accepts a GET request with query parameters including the imageUrl, format, and optionally quality. It fetches the image from the provided URL, converts it to the specified format with the given quality, and sends the converted image as the response. If any required parameters are missing or invalid, or there is an error during the conversion process, it returns a 400 or 500 error with a corresponding message.

Query Parameters

  • imageUrl: The URL of the image to be converted. (Required)

  • format: The target format to which the image should be converted (jpeg, jpg, png, or webp). (Required)

  • quality: The quality level of the converted image. It should be an integer value between 1 and 100. The default quality is 80 if not specified.

Example

GET /es5-es6?imageUrl=http://example.com/image.jpg&format=webp&quality=80

Response

  • If the conversion is successful, the API returns the converted image with the appropriate content type set.

  • If there are any errors during the conversion process or fetching the image, the API returns an error response with status code 500 and a JSON object containing the error message.

Notes

  • Supported input formats: JPEG, PNG, and WebP.

  • Supported output formats: JPEG, PNG, and WebP.

  • The quality parameter is only applicable for formats like JPEG and WebP. It affects the compression level and file size of the converted image.

Last updated