# Color Levels

Fix the tonal range and color balance of an image by adding `colorlevel` options to its URL. Try them in the demo below.

Using an AI coding agent?

Install the [`sirv-dynamic-imaging`](https://www.skills.sh/sirv/image-optimization-skill/sirv-dynamic-imaging) skill, and your agent can build these image URLs for you. Ask in plain words, such as “Serve our product photos as 800px WebP.” [See all 8 skills](/help/rest-api/sirv-skills-for-ai-agents/)

### Demo

Try it

![Original image](https://demo.sirv.com/salomon.jpg?w=800)![Image with the options applied](https://demo.sirv.com/salomon.jpg?w=800&colorlevel.white=215&colorlevel.black=30)OriginalWith options

White level215

Black level30

Channel

rgbrgb

https://demo.sirv.com/salomon.jpg**?colorlevel.white=215&colorlevel.black=30**

[](https://demo.sirv.com/salomon.jpg?colorlevel.white=215&colorlevel.black=30)

### White

`colorlevel.white` is set on a scale from 1 to 255, where 255 is the default.

![White level increased](https://demo.sirv.com/rocky.jpg?colorlevel.white=204)  

`https://demo.sirv.com/rocky.jpg?colorlevel.white=204`

### Black

`colorlevel.black` is set on a scale from 0 to 254, where 0 is the default.

![Black level increased](https://demo.sirv.com/rocky.jpg?colorlevel.black=43)  

`https://demo.sirv.com/rocky.jpg?colorlevel.black=43`

### Black and white together

Black and white levels can be applied at the same time:

![Black and white levels changed](https://demo.sirv.com/rocky.jpg?colorlevel.white=204&colorlevel.black=43)  

`https://demo.sirv.com/rocky.jpg?colorlevel.white=204&colorlevel.black=43`

### Pure white background

Levels can be used to obtain pure white backgrounds, desirable for ecommerce product photography.

Below, Sirv turns an off-white background to pure white. Then it shows an automatically cropped version, using Sirv’s autocrop feature:

![Original image](https://demo.sirv.com/caviar.jpg?w=250&q=90)

Original

![Increased white levels](https://demo.sirv.com/caviar.jpg?colorlevel.white=200&colorlevel.black=9&w=250&q=90)

Increased white levels

![Autocrop and white levels](https://demo.sirv.com/caviar.jpg?colorlevel.white=200&colorlevel.black=9&autocrop=true&w=250&q=90)

White levels and autocrop

`https://demo.sirv.com/caviar.jpg?w=250&q=90`

`https://demo.sirv.com/caviar.jpg?w=250&q=90&colorlevel.white=200&colorlevel.black=9`

`https://demo.sirv.com/caviar.jpg?w=250&q=90&colorlevel.white=200&colorlevel.black=9&autocrop=true`

### Histogram

Sirv can generate a histogram of your image, to help you understand its tonal range. It analyses each pixel of your image and plots it as a chart.

The chart’s numerical range goes from 0-255, counting pixels of 0 as totally black and pixels of 255 as totally white.

`histogram` can be set as `rgb` (for red, green and blue), or any of **r**/**g**/**b** separately.

![Histogram of RGB colors](https://demo.sirv.com/rocky.jpg?histogram=rgb)  

`https://demo.sirv.com/rocky.jpg?histogram=rgb`
