GET
/
transform

How to use

The quality transformation allows you to adjust the overall quality of the image, which affects the file size and visual appearance.

Pass the following query param to the API endpoint:

quality=amount

Where:

  • amount is the quality level in percentage.

For example: quality=75

Parameter

amount: The quality level of the image. This parameter accepts integer values from 0 to 100:

  • 0 represents the lowest quality (highest compression)
  • 100 represents the highest quality (lowest compression)
  • Values in between provide a balance between file size and image quality

Effect of Quality Adjustment

  • Lower quality values result in smaller file sizes but may introduce visible compression artifacts.
  • Higher quality values preserve more detail but result in larger file sizes.
  • This transformation primarily affects lossy formats like JPEG.
  • For PNG images, this transformation has no effect as PNG is a lossless format.

This transformation is useful for optimizing images for web delivery, balancing visual quality with file size.

Original Image (JPEG)

URL : https://www.thunderimage.com/sample/yosemite.jpg

Image with quality set to 20%

URL: /transform?url=https://www.thunderimage.com/sample/yosemite.jpg&quality=20

Image with quality set to 90%

URL: /transform?url=https://www.thunderimage.com/sample/yosemite.jpg&quality=90

Best Practices

  • Use quality values between 70-80 for a good balance between file size and visual quality for most web images.
  • For images with text or sharp edges, consider using higher quality values (80-90) to preserve clarity.
  • For photographic images where some loss of detail is acceptable, lower quality values (50-70) can significantly reduce file size.
  • Always test different quality levels with your specific images to find the optimal balance.
  • Remember that this transformation does not affect PNG images, so use other optimization techniques for PNGs.
  • Consider combining quality adjustment with other transformations like resizing for optimal results.

Note

The quality transformation does not affect PNG images as they use lossless compression. For optimizing PNGs, consider using other transformations or specialized PNG optimization tools.

Authorizations

x-api-key
string
headerrequired

API key required for authentication

Query Parameters

url
string
required

The URL of the image to be transformed.

quality
integer

The quality level of the image in percentage. Lower values result in smaller file sizes but may reduce visual quality.

Required range: 0 < x < 100

Response

200 - image/jpeg

The transformed image in JPEG format.