Add watermarks to images
You need to add watermarks to hundreds of different images to protect copyright, add branding, or mark drafts.
Use AI vision to extract JSON data from receipts, forms, documents, and other images.
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 use Pixeltable's openai.chat_completions() function with multimodal messages that include images directly. Request JSON output via response_format in model_kwargs.
pip install pixeltable openai
OPENAI_API_KEYopenai.chat_completions()pxt.create_table()@pxt.udfinsert()add_computed_column()# Add extraction column using openai.chat_completions with multimodal messagesPROMPT = """Analyze this image and extract the following as JSON:- description: A brief description of the image- objects: List of objects visible in the image- dominant_colors: List of dominant colors- scene_type: Type of scene (indoor, outdoor, etc.)"""messages = [{'role': 'user','content': [{'type': 'text', 'text': PROMPT},{'type': 'image_url', 'image_url': t.image},],}]t.add_computed_column(data=openai.chat_completions(messages,model='gpt-4o-mini',model_kwargs={'response_format': {'type': 'json_object'}},))
One cell of the notebook, copied as it is. Open it in Colab for the rest.
You need to add watermarks to hundreds of different images to protect copyright, add branding, or mark drafts.
You need to make hundreds of images semi-transparent for backgrounds, overlays, or watermarks.
You need to apply filters to hundreds of images—blur, sharpen, edge detection, and other enhancements.
You need to fix inconsistent lighting across hundreds of images—adjusting brightness, contrast, and color saturation.