images-and-pixels

Installation
SKILL.md

Images and Pixels in Python

Trigger

Use this skill when the user:

  • Creates an image with bpy.data.images.new and fills it from code (test cards, masks, lookup textures, bake targets)
  • Reads or writes Image.pixels, or mentions foreach_get / foreach_set, float_buffer, is_float, channels
  • Hits TypeError from pixels.foreach_set / foreach_get (wrong length: RGB stride, or a buffer sized before Image.scale())
  • Sees an image land upside down in the saved file, or pixels that changed after Image.save()
  • Saves PNG or OpenEXR and loses alpha, gets low-alpha pixels clamped to white, or finds save_render wrote a PNG despite image.file_format = "OPEN_EXR"

High-level shape

import bpy

W, H = 512, 288
img = bpy.data.images.new("Card", W, H, alpha=True)  # byte (8-bit) by default
Installs
7
GitHub Stars
19
First Seen
9 days ago