샘플
pillow 12.3.0: PIL.ImageDraw, PIL.ImageDraw.Draw, PIL.ImageDraw.ImageDraw
검증된 샘플 — pypi pillow 12.3.0: PIL.ImageDraw, PIL.ImageDraw.Draw, PIL.ImageDraw.ImageDraw. python 3.12 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:cac23e1228b1d9327afaf85c45d61198531f67935f6a79ad82dd4c714d5b5c16
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
python 3.12 linux 24 · ubuntu · glibc 2.39 x64 python 3.12 python pip
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-alpine@sha256:d09d15e60962… |
2026-08-28 |
케이스
HOW- 목표
- verify PIL.ImageDraw in pkg:pypi/pillow@12.3.0
- 패키지
- 심벌
-
- PIL.ImageDraw
- PIL.ImageDraw.Draw
- PIL.ImageDraw.ImageDraw
- 환경
- python 3.12
- 생성일
- 2026-08-28T04:19:00Z
컨트랙트
- ImageDraw.Draw attaches to an Image canvas and returns an ImageDraw instance for in-place rendering.
- ImageDraw.Draw.point draws individual pixels at specified coordinates with given fill color.
- ImageDraw.Draw.line draws lines between coordinate sequences with fill color and width.
- ImageDraw.Draw.rectangle renders filled and outlined rectangles with bounding box coordinates.
- ImageDraw.Draw.ellipse renders filled and outlined ellipses within bounding boxes.
- ImageDraw.Draw.polygon renders filled and outlined polygons across multiple vertices.
- ImageDraw.Draw.rounded_rectangle renders rectangles with specified corner radii.
- ImageDraw.Draw.text renders string glyphs onto the image canvas.
- ImageDraw.Draw.regular_polygon renders n-sided regular polygons inside a bounding circle.
- ImageDraw.Draw raises an error when image argument is None.
파일
- PROMPT.md
- csx.json
- requirements.txt
- spec.json
- test/contract.py
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify PIL.ImageDraw in pkg:pypi/pillow@12.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/pillow@12.3.0
Demonstrate these symbols/APIs:
- PIL.ImageDraw
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:0c44583f6889d6fe7a58a25ca0317eec4d45f540bebc1499f11b51658e7cf243","contract":["ImageDraw.Draw attaches to an Image canvas and returns an ImageDraw instance for in-place rendering.","ImageDraw.Draw.point draws individual pixels at specified coordinates with given fill color.","ImageDraw.Draw.line draws lines between coordinate sequences with fill color and width.","ImageDraw.Draw.rectangle renders filled and outlined rectangles with bounding box coordinates.","ImageDraw.Draw.ellipse renders filled and outlined ellipses within bounding boxes.","ImageDraw.Draw.polygon renders filled and outlined polygons across multiple vertices.","ImageDraw.Draw.rounded_rectangle renders rectangles with specified corner radii.","ImageDraw.Draw.text renders string glyphs onto the image canvas.","ImageDraw.Draw.regular_polygon renders n-sided regular polygons inside a bounding circle.","ImageDraw.Draw raises an error when image argument is None."],"goal":"verify PIL.ImageDraw in pkg:pypi/pillow@12.3.0","kind":"HOW","packages":["pkg:pypi/pillow@12.3.0"],"schemaVersion":1,"symbols":["PIL.ImageDraw","PIL.ImageDraw.Draw","PIL.ImageDraw.ImageDraw"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","language":"python","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","runtime":"python","runtimeVersion":"3.12","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/pillow@12.3.0"],"schemaVersion":1,"subject":"pkg:pypi/pillow@12.3.0","symbols":["PIL.ImageDraw","PIL.ImageDraw.Draw","PIL.ImageDraw.ImageDraw"],"verifierAdapter":"python@1"}
pillow==12.3.0
{
"schemaVersion": 1,
"goal": "verify PIL.ImageDraw in pkg:pypi/pillow@12.3.0",
"kind": "HOW",
"packages": [
"pkg:pypi/pillow@12.3.0"
],
"symbols": [
"PIL.ImageDraw"
]
}
import sys
import PIL
from PIL import Image, ImageDraw
# Verify Pillow version and ImageDraw module
assert PIL.__version__ == "12.3.0"
assert hasattr(ImageDraw, "Draw")
assert hasattr(ImageDraw, "ImageDraw")
# 1. ImageDraw.Draw attaches to an image and mutates it
img = Image.new("RGB", (20, 20), color=(0, 0, 0))
draw = ImageDraw.Draw(img)
assert isinstance(draw, ImageDraw.ImageDraw)
# 2. Point drawing
draw.point((0, 0), fill=(255, 0, 0))
draw.point([(1, 1), (2, 2)], fill=(0, 255, 0))
assert img.getpixel((0, 0)) == (255, 0, 0)
assert img.getpixel((1, 1)) == (0, 255, 0)
assert img.getpixel((2, 2)) == (0, 255, 0)
# 3. Line drawing with width
img_line = Image.new("RGB", (20, 20), color=(0, 0, 0))
draw_line = ImageDraw.Draw(img_line)
draw_line.line([(0, 5), (19, 5)], fill=(0, 0, 255), width=1)
assert img_line.getpixel((0, 5)) == (0, 0, 255)
assert img_line.getpixel((10, 5)) == (0, 0, 255)
assert img_line.getpixel((19, 5)) == (0, 0, 255)
assert img_line.getpixel((10, 4)) == (0, 0, 0)
# 4. Rectangle drawing with fill and outline
img_rect = Image.new("RGB", (20, 20), color=(0, 0, 0))
draw_rect = ImageDraw.Draw(img_rect)
draw_rect.rectangle([(2, 2), (8, 8)], fill=(100, 100, 100), outline=(255, 255, 255), width=1)
# Outline border
assert img_rect.getpixel((2, 2)) == (255, 255, 255)
assert img_rect.getpixel((8, 8)) == (255, 255, 255)
# Filled interior
assert img_rect.getpixel((5, 5)) == (100, 100, 100)
# Outside
assert img_rect.getpixel((0, 0)) == (0, 0, 0)
# 5. Ellipse drawing with fill and outline
img_ellipse = Image.new("RGB", (20, 20), color=(0, 0, 0))
draw_ellipse = ImageDraw.Draw(img_ellipse)
draw_ellipse.ellipse([(2, 2), (8, 8)], fill=(200, 50, 50), outline=(255, 255, 0), width=1)
assert img_ellipse.getpixel((5, 5)) == (200, 50, 50)
assert img_ellipse.getpixel((0, 0)) == (0, 0, 0)
# 6. Polygon drawing
img_poly = Image.new("RGB", (20, 20), color=(0, 0, 0))
draw_poly = ImageDraw.Draw(img_poly)
draw_poly.polygon([(5, 2), (9, 8), (1, 8)], fill=(50, 200, 50), outline=(0, 255, 255))
assert img_poly.getpixel((5, 5)) == (50, 200, 50)
assert img_poly.getpixel((0, 0)) == (0, 0, 0)
# 7. Rounded rectangle drawing
img_round = Image.new("RGB", (20, 20), color=(0, 0, 0))
draw_round = ImageDraw.Draw(img_round)
draw_round.rounded_rectangle([(2, 2), (18, 18)], radius=3, fill=(120, 120, 120))
assert img_round.getpixel((10, 10)) == (120, 120, 120)
# Corner at (2,2) should be untouched due to radius
assert img_round.getpixel((2, 2)) == (0, 0, 0)
# 8. Text drawing
img_text = Image.new("RGB", (50, 20), color=(0, 0, 0))
draw_text = ImageDraw.Draw(img_text)
draw_text.text((2, 2), "PIL", fill=(255, 255, 255))
# Verify text was rendered onto the canvas
rendered_pixels = [img_text.getpixel((x, y)) for x in range(50) for y in range(20)]
assert any(p != (0, 0, 0) for p in rendered_pixels)
# 9. Regular polygon drawing
img_reg_poly = Image.new("RGB", (20, 20), color=(0, 0, 0))
draw_reg_poly = ImageDraw.Draw(img_reg_poly)
draw_reg_poly.regular_polygon(bounding_circle=((10, 10), 8), n_sides=6, fill=(150, 150, 0))
assert img_reg_poly.getpixel((10, 10)) == (150, 150, 0)
# 10. Error cases
try:
ImageDraw.Draw(None)
assert False, "Expected ValueError/TypeError when image is None"
except (ValueError, TypeError, AttributeError):
pass
print("PIL.ImageDraw contract passed")
오리진 시더
익명