Max Bytes
Automatically degrades the quality of the image to fit within a specified file size.
The max_bytes
transformation automatically degrades the quality of the image until the image is under the specified amount of bytes.
How to use
Pass the following query param
max_bytes=amount
to the API endpoint.
The amount
represents the maximum file size in bytes that the image should not exceed.
Notes
- The
amount
should be a positive integer representing the maximum number of bytes. - The actual file size of the resulting image may be slightly less than the specified
amount
. - This transformation may result in a loss of image quality, especially for larger reductions in file size.
- There is no upper limit to the
amount
parameter, but it should be reasonable for image files (typically under 10,000,000 bytes, or 10 MB, for web use).
Original Image
URL: https://www.thunderimage.com/sample/yosemite.jpg
Image with Max Bytes Set
URL: /transform?url=https://www.thunderimage.com/sample/yosemite.jpg&max_bytes=51200
In this example, the image is limited to a maximum size of 50 KB (51,200 bytes). The visual difference may not be noticeable for small reductions, but larger reductions can impact image quality.
Authorizations
API key required for authentication
Query Parameters
The URL of the image to be transformed.
Sets the background color of a transparent image. Accepts a color name or hexadecimal RGB expression without the “#” character.
Response
The transformed image in PNG format.