Transform images with PIL operations
You need to resize, rotate, crop, or convert hundreds of images—and keep track of all the transformed versions.
You need to fix inconsistent lighting across hundreds of images—adjusting brightness, contrast, and color saturation.
Images · Notebook · Updated
Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.
You adjust brightness, contrast, and saturation for images in your table using custom UDFs that wrap Pillow's ImageEnhance module (relies on PIL/Pillow). This lets you control enhancement levels to match your needs.
You can iterate on transformations before adding them to your table. Use .select() with .collect() to preview results on sample images—nothing is stored in your table. If you want to collect only the first few rows, use .head(n) instead of .collect(). Once you're satisfied, use .add_computed_column() to apply the adjustments to all images in your table.
pip install pixeltable
pxt.create_table()@pxt.udfinsert()add_computed_column()# Brightness adjustments (1.0 = original)t.add_computed_column(darker=adjust_brightness(t.image, 0.5))t.add_computed_column(brighter=adjust_brightness(t.image, 1.5))# Contrast adjustmentst.add_computed_column(low_contrast=adjust_contrast(t.image, 0.5))t.add_computed_column(high_contrast=adjust_contrast(t.image, 2.0))# Color saturationt.add_computed_column(desaturated=adjust_saturation(t.image, 0.3))t.add_computed_column(saturated=adjust_saturation(t.image, 2.0))
One cell of the notebook, copied as it is. Open it in Colab for the rest.
You need to resize, rotate, crop, or convert hundreds of images—and keep track of all the transformed versions.
You need to convert color images to grayscale for analysis, preprocessing, or model inputs that require single-channel images.
Run YOLOX object detection in Python on images and video frames, then query and draw the detected objects.
Automatically identify and locate objects in images using YOLOX object detection models.