Logotipo de Pillow

Pillow

Organización
openbotx
pillow

Manipulate images locally using Python and PIL/Pillow. Use when the user asks to resize, crop, rotate, flip, filter, enhance, combine, overlay, watermark, add text to, convert, compress, create, or edit images locally. Also use for thumbnails, borders, color adjustments, transparency, animated GIFs, or extracting image metadata.

Add to TypingMind

Descripción general

Editoropenbotx
Repositorioopenbotx
Nombre de la habilidadpillow
Estrellas
95
Forks
25
Archivos incluidos
1
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Archivos incluidos: 1

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por openbotx en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Pillow en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/openbotx/openbotx/tree/main/openbotx/skills/pillow
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/openbotx/openbotx.git /tmp/openbotx
mkdir -p .claude/skills
cp -r /tmp/openbotx/openbotx/skills/pillow .claude/skills/pillow
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Pillow en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Pillow automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Pillow no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Pillow — Local Image Manipulation

Use write_file to create a Python script, then exec to run it.

Workflow

  1. Write a .py script with write_file
  2. Run it with exec(command="python3 script.py")
  3. Print output so you can read the result
  4. Clean up the script after use

Always use paths relative to the workspace. Print confirmation messages so the result is visible.

python
# example: resize an image
from PIL import Image
img = Image.open("photos/input.jpg")
img = img.resize((800, 600), Image.Resampling.LANCZOS)
img.save("photos/output.jpg", quality=90)
print(f"Saved {img.size[0]}x{img.size[1]}")

Open, Save, Convert

python
from PIL import Image

img = Image.open("photo.jpg")          # auto-detects format
img.save("photo.png")                  # format from extension
img.save("photo.webp", quality=85)     # WebP with quality
img.save("photo.jpg", quality=95, optimize=True)  # optimized JPEG

# format conversion
rgb = img.convert("RGB")               # drop alpha for JPEG
rgba = img.convert("RGBA")             # add alpha channel
gray = img.convert("L")                # grayscale

Supported formats: JPEG, PNG, WebP, GIF, BMP, TIFF, ICO, PPM, AVIF

Create from Scratch

python
from PIL import Image

# solid color
img = Image.new("RGB", (800, 600), (255, 255, 255))       # white
img = Image.new("RGBA", (800, 600), (0, 0, 0, 0))         # transparent

# gradient
img = Image.new("RGB", (800, 100))
pixels = img.load()
for x in range(800):
    r = int(255 * x / 800)
    for y in range(100):
        pixels[x, y] = (r, 0, 255 - r)

Resize and Transform

python
from PIL import Image

img = Image.open("photo.jpg")

# resize to exact dimensions
resized = img.resize((800, 600), Image.Resampling.LANCZOS)

# thumbnail — preserves aspect ratio, modifies in place
img.thumbnail((400, 400), Image.Resampling.LANCZOS)

# crop (left, upper, right, lower)
cropped = img.crop((100, 50, 500, 400))

# rotate (degrees counterclockwise, expand=True to fit)
rotated = img.rotate(45, expand=True, fillcolor=(255, 255, 255))

# flip and transpose
flipped_h = img.transpose(Image.Transpose.FLIP_LEFT_RIGHT)
flipped_v = img.transpose(Image.Transpose.FLIP_TOP_BOTTOM)
rotated_90 = img.transpose(Image.Transpose.ROTATE_90)
rotated_180 = img.transpose(Image.Transpose.ROTATE_180)
rotated_270 = img.transpose(Image.Transpose.ROTATE_270)

Resampling: LANCZOS (best quality), BICUBIC, BILINEAR, NEAREST (fastest)

Draw Shapes

python
from PIL import Image, ImageDraw

img = Image.new("RGB", (600, 400), "white")
draw = ImageDraw.Draw(img)

# rectangle
draw.rectangle([(50, 50), (200, 150)], fill="red", outline="black", width=2)

# rounded rectangle
draw.rounded_rectangle([(250, 50), (400, 150)], radius=20, fill="blue")

# ellipse / circle
draw.ellipse([(50, 200), (200, 350)], fill="green", outline="black", width=2)

# polygon
draw.polygon([(300, 200), (400, 350), (200, 350)], fill="orange")

# line
draw.line([(0, 0), (600, 400)], fill="black", width=3)

# arc (start_angle, end_angle in degrees)
draw.arc([(420, 50), (580, 200)], 0, 270, fill="purple", width=3)

# pie slice (filled arc)
draw.pieslice([(420, 220), (580, 370)], 0, 270, fill="cyan")

# regular polygon (bounding_circle, n_sides)
draw.regular_polygon((500, 100, 40), 6, fill="gold")  # hexagon

Add Text

python
from PIL import Image, ImageDraw, ImageFont

img = Image.new("RGB", (600, 200), "white")
draw = ImageDraw.Draw(img)

# load font (use default if truetype not available)
try:
    font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 40)
except OSError:
    font = ImageFont.load_default(40)

# simple text
draw.text((50, 50), "Hello World", fill="black", font=font)

# centered text using anchor
draw.text((300, 100), "Centered", fill="blue", font=font, anchor="mm")

# multiline text
draw.multiline_text((50, 120), "Line 1\nLine 2", fill="gray", font=font, spacing=8)

# measure text
bbox = font.getbbox("Hello")           # (left, top, right, bottom)
width = font.getlength("Hello")        # width in pixels

Anchors: First letter = horizontal (left, middle, right), second = vertical (top, middle, baseline, descent). Common: mm = center, lt = top-left, rm = right-center.

Font paths:

  • Linux: /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
  • macOS: /System/Library/Fonts/Helvetica.ttc
  • Fallback: ImageFont.load_default(size) (no file needed)

Filters and Effects

python
from PIL import Image, ImageFilter

img = Image.open("photo.jpg")

# predefined filters
blurred = img.filter(ImageFilter.BLUR)
sharp = img.filter(ImageFilter.SHARPEN)
edges = img.filter(ImageFilter.FIND_EDGES)
contour = img.filter(ImageFilter.CONTOUR)
emboss = img.filter(ImageFilter.EMBOSS)
detail = img.filter(ImageFilter.DETAIL)

# parameterized filters
gaussian = img.filter(ImageFilter.GaussianBlur(radius=5))
box = img.filter(ImageFilter.BoxBlur(radius=3))
unsharp = img.filter(ImageFilter.UnsharpMask(radius=2, percent=150, threshold=3))
median = img.filter(ImageFilter.MedianFilter(size=5))

See references/api.md for all filters including MinFilter, MaxFilter, ModeFilter, RankFilter, and custom Kernel.

Color Adjustments

python
from PIL import Image, ImageEnhance, ImageOps

img = Image.open("photo.jpg")

# ImageEnhance — factor: 0.0=min, 1.0=original, >1=more
bright = ImageEnhance.Brightness(img).enhance(1.3)     # brighter
contrast = ImageEnhance.Contrast(img).enhance(1.5)     # more contrast
saturated = ImageEnhance.Color(img).enhance(1.4)        # more vivid
sharpened = ImageEnhance.Sharpness(img).enhance(2.0)    # sharper

# ImageOps — quick operations
gray = ImageOps.grayscale(img)
inverted = ImageOps.invert(img)
auto = ImageOps.autocontrast(img)
equalized = ImageOps.equalize(img)
posterized = ImageOps.posterize(img, bits=4)
solarized = ImageOps.solarize(img, threshold=128)

# colorize a grayscale image
colored = ImageOps.colorize(gray, black="navy", white="gold")

Compositing

python
from PIL import Image

base = Image.open("background.png").convert("RGBA")
overlay = Image.open("foreground.png").convert("RGBA")

# paste at position (no blending — replaces pixels)
base.paste(overlay, (100, 50))

# paste with alpha mask (transparent areas preserved)
base.paste(overlay, (100, 50), mask=overlay)

# alpha composite (full RGBA blending, images must be same size)
overlay_resized = overlay.resize(base.size)
result = Image.alpha_composite(base, overlay_resized)

# blend two images (same size, alpha 0.0=img1, 1.0=img2)
blended = Image.blend(img1, img2, alpha=0.5)

# composite with mask (where mask=255: img1, mask=0: img2)
result = Image.composite(img1, img2, mask)

Watermarks

Text watermark with transparency

python
from PIL import Image, ImageDraw, ImageFont

img = Image.open("photo.jpg").convert("RGBA")
w, h = img.size

# create transparent overlay
txt_layer = Image.new("RGBA", (w, h), (0, 0, 0, 0))
draw = ImageDraw.Draw(txt_layer)

try:
    font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 48)
except OSError:
    font = ImageFont.load_default(48)

# semi-transparent white text, centered
draw.text((w // 2, h // 2), "WATERMARK", fill=(255, 255, 255, 100),
          font=font, anchor="mm")

result = Image.alpha_composite(img, txt_layer)
result.convert("RGB").save("watermarked.jpg", quality=90)

Image watermark with opacity

python
from PIL import Image, ImageEnhance

base = Image.open("photo.jpg").convert("RGBA")
logo = Image.open("logo.png").convert("RGBA")

# resize logo
logo = logo.resize((150, 150), Image.Resampling.LANCZOS)

# reduce opacity
alpha = logo.split()[3]
alpha = ImageEnhance.Brightness(alpha).enhance(0.4)  # 40% opacity
logo.putalpha(alpha)

# position at bottom-right with margin
pos = (base.width - logo.width - 20, base.height - logo.height - 20)
base.paste(logo, pos, mask=logo)
base.convert("RGB").save("branded.jpg", quality=90)

Borders and Padding

python
from PIL import Image, ImageOps

img = Image.open("photo.jpg")

# add solid border
bordered = ImageOps.expand(img, border=20, fill="black")
bordered = ImageOps.expand(img, border=(10, 20, 10, 20), fill="white")  # L, T, R, B

# pad to target size (letterbox/pillarbox)
padded = ImageOps.pad(img, (800, 800), color="black", centering=(0.5, 0.5))

# contain — resize to fit within box, preserving aspect ratio
contained = ImageOps.contain(img, (800, 800))

# cover — resize to fill box, preserving aspect ratio (may crop)
covered = ImageOps.cover(img, (800, 800))

# fit — resize and crop to fill exact size
fitted = ImageOps.fit(img, (800, 800))

Animated GIFs

Extract frames

python
from PIL import Image

gif = Image.open("animation.gif")
for i in range(gif.n_frames):
    gif.seek(i)
    gif.copy().save(f"frame_{i:03d}.png")
print(f"Extracted {gif.n_frames} frames")

Create animated GIF

python
from PIL import Image

frames = [Image.open(f"frame_{i:03d}.png") for i in range(10)]
frames[0].save(
    "animation.gif",
    save_all=True,
    append_images=frames[1:],
    duration=100,       # ms per frame
    loop=0,             # 0 = infinite loop
    optimize=True,
)

Image Info

python
from PIL import Image

img = Image.open("photo.jpg")

print(f"Size: {img.size}")             # (width, height)
print(f"Mode: {img.mode}")             # RGB, RGBA, L, etc.
print(f"Format: {img.format}")         # JPEG, PNG, etc.
print(f"Info: {img.info}")             # metadata dict (dpi, exif, etc.)
print(f"Bbox: {img.getbbox()}")        # bounding box of non-zero regions
print(f"Colors: {img.getcolors(256)}") # list of (count, color) or None
print(f"Extrema: {img.getextrema()}")  # (min, max) per channel

Channel Operations

python
from PIL import Image

img = Image.open("photo.jpg")

# split into bands
r, g, b = img.split()

# merge bands
swapped = Image.merge("RGB", (b, g, r))  # swap red and blue

# get single channel
red = img.getchannel("R")  # or by index: img.getchannel(0)

Tips

  • Always convert("RGBA") before alpha compositing or watermark operations
  • Use thumbnail() to resize preserving aspect ratio — it modifies in place
  • Use img.copy() before destructive in-place operations
  • Use Image.Resampling.LANCZOS for best quality when resizing
  • Convert back to "RGB" before saving as JPEG (no alpha support)
  • Use ImageOps.exif_transpose(img) to auto-rotate photos based on EXIF orientation
  • For detailed API reference with all parameters, read references/api.md

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Son archivos de solo lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Pillow?

Manipulate images locally using Python and PIL/Pillow. Use when the user asks to resize, crop, rotate, flip, filter, enhance, combine, overlay, watermark, add text to, convert, compress, create, or edit images locally. Also use for thumbnails, borders, color adjustments, transparency, animated GIFs, or extracting image metadata.

¿Por qué usar Pillow en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Pillow está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Pillow en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/openbotx/openbotx/tree/main/openbotx/skills/pillow. TypingMind lee el archivo SKILL.md de esa carpeta, empaqueta los archivos de la carpeta e instala el conjunto como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Pillow?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Pillow?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Pillow con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Pillow?

Sí. openbotx la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇