All annotation is now free in Hasty.

Color Jitter

This data augmentation tool adds brightness, contrast, saturation, and hue to your sample images.



It sets the brightness of the transformed image.


In visual perception, contrast refers to the difference of color and brightness of objects in the same field of view.

The left part of the image has lower contrast than the right part.


Color saturation refers to the intensity and the purity of a color as displayed in the image. If the image is highly saturated then the colors are more intense and vivid.

Original image
Saturated image


Hue is one of the main indication of the appearance of the color itself. It refers to the attribute of the visible light due to which it is differentiated from or similar to primary colors: red, green, and blue. Usually, colors with the same hue are distinguished with adjectives referring to their lightness or colorfulness, such as with "light blue", "pastel blue", etc.

The augmentation randomly picks a different "shift" to change the hue of the sample images.

Original image shifted in different colors.

Code Implementation

import albumentations as albu
from PIL import Image
import numpy as np

transform =albu.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2, hue=0.2, p=0.5)

image = np.array('/some/image/file/path'))
image = transform(image=image)['image']

# Now the image is transformed and ready to be accepted by the model

Further Resources

Last updated on Jun 01, 2022

Removing the risk from vision AI.

Only 13% of vision AI projects make it to production, with Hasty we boost that number to 100%.