Community画像github.com

コード画室アトリエ

画像モデルを呼ばず、コードで静止画を描く。パストレーシング、水彩、漫画、版画、タイポポスターまで。

コード画室アトリエ とは?

コードで絵を仕上げる画室です。画風を選び、短いシーンを書いて PNG を自分で書き出します。人物、風景、文字、ドット絵、生成的な抽象まで扱えます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Wexop/atelier/tree/HEAD

Installed? Explore more 画像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

atelier — 短いPythonスクリプトで動く画像スタジオ

インストール(Python ≥ 3.11): pip install git+https://github.com/Wexop/atelier(更新: pip install -U git+...) 確認: atelier palette · atelier brushes · atelier fx(シグネチャ)。

ループ(常に)

  1. スタイルガイド(下記Styles参照)を選んで読む。該当なし → styles/new-style.md。
  2. scene.py を書く(30~80行、from atelier import *、Canvas c を構築、最後に c.save(__file__[:-3] + ".png"))。
  3. atelier render scene.py --preview → scene_prev.jpg(512 px、実際の低解像度レンダリング、保存はスキップ)。画像を読む。
  4. atelier inspect scene.py → scene_sheet.jpg: ビュー、5値スタディ+三分割法/フォーカル、クリップマップ、ヒストグラム、パレット、4つの自動ズーム(エイリアシング、バンディング、ノイズ、ハイライト)に --crop x,y,w,h のラベル、メトリクス+レッドフラグ。読む。 ズーム: atelier render scene.py --crop x,y,w,h。
  5. ≥3回のルックアンドフィックスラウンド(atelier compare old.png new.png でA/B比較)、その後 atelier render scene.py(最終版; --scale 2, --seed N → SEED)。 エラーは1行 scene.py:LINE: Type: message で出力(--debug でトレースバック)。

規約

  • 描画座標 = キャンバスpx(y下向き)。フィールドは正規化されたx, y ∈ [0,1]を使用。色: "#hex", CSS名, (r,g,b) 0–1 または 0–255。
  • ペイントソース(fill=, color=, stroke=) = 色 | フィールド | f(x,y) | 配列 H×W×3/4。マスク = フィールド | シェイプ | 配列 | f(x,y)。
  • ランダムなものはすべて seed= を受け付ける。プレビューは低解像度でレンダリング: 画像は同一で、最終版のみシャープになる。

キャンバスとレイヤー(コア)

c = Canvas(w, h, bg=None, pixel=False)      # pixel=True: AAなし、固定スケール、ニアレストネイバーエクスポート
L = c.layer(blend="normal", opacity=1, mask=None)   # 新しいレイヤー、現在のレイヤーになる;c.use(L)で切り替え
ブレンド: normal multiply screen overlay soft_light hard_light add subtract color_dodge color_burn darken lighten difference hue saturation color luminosity
c.fill(src, mask=None) · c.erase(mask) · c.place(img|path, x=None, y=None, scale=None(cover), rot=0, fit="cover"|"contain", blend, opacity) -> レイヤー
c.apply(*fx, mask=None)   # 全レイヤーをマージ、その後エフェクト(最終グレーディング); L.apply(*fx, mask=None) = 1レイヤー
c.save(path, quality=92, scale=1, smooth=None) · c.preview(path, width=512) · c.crop_preview(path, x, y, w, h)
c.flatten() -> H×W×4 float · L.rgba (取得/設定) · c.w c.h(論理)c.W c.H c.s(ラスタスケール)

フィールド(field)— 遅延評価、合成可能: + - * / ** > <, np.sin(f), f.ramp() f.warp() f.scale() f.rotate() f.move() f.remap(lo,hi) f.clip() f.within(形状|(x0,y0,x1,y1))

X Y radial(cx,cy) angle(cx,cy) · Field(lambda x, y: ...)
perlin/simplex/value(scale=4, seed) · fbm(scale=4, octaves=5, lacunarity=2, gain=.5, seed, base="perlin")
ridged(scale=3, ...) · turbulence(scale=4, ...) · worley(scale=6, mode="F1"|"F2"|"F2-F1"|"id", seed)
domain_warp(f, strength=.1, scale=2, seed) · aastep(f, edge=.5) · smoothstep(e0, e1, v) · mix(a, b, t)
パターン [0,1]: wood(rings=14, angle) marble() clouds(scale, cover=.5, sharp) terrain_height() water_ripples() fabric(scale=60) paper() stars(density=60, size)
gradient(ストップ, angle=90(上→下; 0 = 左→右), kind="linear"|"radial"|"conic", center, radius)
ramp(f, ストップ) / f.ramp("sunset") · ストップ = パレット名 | ["#..", ...] | [(pos, col), ...]   (OKLab補間)
palette("name") 名前: sunset night ocean forest desert earth fire ice pastel neon vapor viridis wood marble mono retro16 green4
cosine_palette(a, b, c, d, n=8) · rgb2hsv hsv2rgb rgb2oklab oklab2rgb
shade(高さ, light=(方位角, 仰角), strength=1, color=None, ambient=.25, spec=0)   # 色なし → グレー、flat=0.5(オーバーレイレイヤーで使用)
マスク: top(f) bottom(f) left(f) right(f) band(y0, y1) zone(x0, y0, x1, y1) disc(cx, cy, r)  (すべてsoft=)
カーブ: f.ridge_line(y=.6, amp=.15) / curve(lambda x: y) → c.fill_below(curve, src) / fill_above · curve.below()

ベクターとテキスト(vector)— Shape = skiaパス、Fieldマスクとしても機能;ブール演算 | & - ^

rect(x, y, w, h, r=0) ellipse(cx, cy, rx, ry) circle(cx, cy, r) polygon(pts) line(x1,y1,x2,y2 | pts) regular(cx,cy,r,n)
star(cx, cy, r, r2, n=5) arc(cx, cy, r, start, sweep) spline(pts, closed) svg("M .. C .. A .. Z") union(*shapes)
shape.move/rotate(deg)/scale/outline(width, dash)/soft(フェザー)/points(n)/bounds/length
c.draw(shape, fill="black", stroke=None, width=2, cap="round", join="round", dash=(on, off), feather=0, opacity=1)
c.rect/ellipse/circle/polygon/line/spline/path(d)(..., **same style)
c.text(txt, x, y, size=32, fill, font="sans"|"mono"|"serif"|family|path.ttf, weight="regular"|"semibold"|"bold"|int,
       align="left"|"center"|"right", valign="baseline"|"top"|"middle"|"bottom", spacing=em, line_height=1.2, italic, fit=width_px, kern=True)
text_shape(...) → Shape · text_size(txt, size) → (width, cap_height) · c.text_on_path(txt, shape|points, size, align, lift, fit, fill)
c.text_box(txt, x, y, w, h=None, size=18, align="left"|"justify"|"center", line_height=1.4, fit=True)   # **b** *i* [#c33]color[/]
c.title(txt, x, y, size=96, style="shadow"|"extrude"|"outline"|"inline"|"neon", fill, color2)

ブラシ(brush)

c.stroke(points|Shape, brush="round", size=12, color, pressure=[...]|f(t)|float, opacity, jitter, spacing, taper=(a, b), seed, **params)
ブラシ: round round_soft airbrush ink(speed) chalk(tooth) bristle(n, var, gaps) oil(impasto, pickup) watercolor(edge, granulation, bleed)
c.paint_like(ref, brush="oil", sizes=(48,24,12), tol=.08, angle=0, seed)   # リファレンス(Canvas/Field/画像)をストロークで再ペイント
c.scatter(what, n, region=mask, size=(a, b), color=col|list|palette|Field, color_jitter, rot=(a, b), seed)
   what: dot soft star grass leaf petal square person | Shape(原点(0,0)での単位サイズ)
c.hatch(region, angle=45, spacing=8, width=1.2, color, tone=Field(0=暗い→太い), cross=False, wobble)
km_mix(a, b, t) 顔料のような混合(青+黄=緑) · L.relief = 1.0(オイルインパスト照明強度)

エフェクト(fx)— c.apply(...) / L.apply(...);サイズはキャンバスpx

blur(r) motion_blur(len, angle) sharpen(amt) bloom(threshold=.75, radius=12, strength=.8, tint) glow(r, strength, color)
drop_shadow(dx, dy, r, color, opacity) inner_shadow(...) vignette(amount=.35, softness=.6) grain(amount=.04, size=1, seed)
chromatic_aberration(px) lens_distortion(k) exposure(絞り) contrast(amt) levels(black, white, gamma) curves([(in, out), ...], channel)
hue_sat(hue_deg, sat_mult, light) saturation(x) color_balance(shadows=(r,g,b), mids, highlights) gradient_map(ストップ) invert()
tone_map("agx"|"filmic"|"reinhard", exposure, look="punchy") displace(field, strength) posterize(levels)
pixelate(size, palette=name|list, colors=N, dither=None|"bayer"|"fs", strength=.6) halftone(size, angle, ink, paper, cmyk=False)
god_rays(x, y, rays=14, length=.9, strength=.45, color, threshold=.7, occlude=True) lens_flare(x, y, strength=.6, color, ghosts=6, streak=.5)
depth_of_field(depth, focus, aperture=8)   # depthは c.render(scene) から
match_palette("ref.jpg", amount) transfer_tone(ref, amount)   # リファレンス画像からの色/トーン転送

スタイライズ(stylize)— 3D→イラスト + 絵画風フィルター(c.apply / L.apply用エフェクト)

r = c.render(s, alpha=True); c.cur.apply(toon(r, bands=3, shadow=.45, colors={id: col}), shadow_dots(r, size=5, lo=.3), outlines(r, width=2.5, inner=1))
彫刻: L.fill(PAPER, mask=r.alpha); L.apply(render_hatch(r, s, spacing=4.5, layers=3), outlines(r, width=2))  # ハッチングは3Dサーフェスに沿う
kuwahara(radius=6) oil · xdog(sigma=1, eps=.9, ink, paper) インク線画 · pencil() · linocut(lines=7, angle) · edge_smooth(4)
watercolorize(bleed=2, edge=1, granulation=.4, ink=0..1) · stained_glass(cell=26, lead=3) · mosaic(tile=10) · shading(r) → (H,W) light

3D(sdf)— y上向き、単位≈メートル、プリミティブは原点中心

sphere(r) box(w, h, d) round_box(w, h, d, r) cylinder(r, h) capsule(a, b, r) torus(R, r) cone(r1, h, r2) plane(y, normal)
ellipsoid(rx, ry, rz) lathe([(radius, y), ...] 下→上, thickness=None|shell) extrude([(x, y), ...], depth)
演算: a | b, a & b, a - b, a.union(b, k=smooth) .inter .sub · .move(x,y,z) .rotate(x,y,z deg) .scale(k|(kx,ky,kz))
     .onion(t) .round(r) .twist(k) .bend(k) .repeat(period, count) .mirror("x") .elongate() .displace(noise3(scale, octaves, seed), amount)
Mat(color | 2D Field (proj="tri"|"xz"|"xy"|"zy", tex_scale) | f(p, n)->(N,3), rough=.5|Field|f(p,n), metal=0, glass=0, ior=1.45,
    sss=0, sss_color, emit=None, power=1, bump=.3, bump_scale=60, local=True(テクスチャはオブジェクトに追従), sheen=.6,
    wear=[smudges(.5), scratches(.5, density=40), dust(.3), edge_wear(.5, width=.01, color)])
s = Scene(); id = s.add(sdf, Mat(...)); s.camera(pos, target, fov=40)
s.sun(dir_toward_sun, color, power=3, soft=.04) · s.point(pos, color, power, radius) · s.area(pos, size=(w,h), normal, color, power, pattern="window"|"softbox", visible)
s.studio(key, target, size, power=45, window=True, fill=.2, bg) · s.sky(zenith, horizon, ground, power) · s.fog(color, density)
r = c.render(s, aa=1|2, exposure=0, look=None|"punchy", alpha=False)          # 高速レイマーチャー(直接光+AO+1回反射)
r = c.pathtrace(s, spp=16, bounces=4, denoise=True, aperture=0, focus=None|dist|(x,y), seed=SEED)  # フォトリアル: GI、多重屈折ガラス、適応AA
r.depth r.normal r.id r.mask(id) r.focus_at(x, y, c.s) r.linear r.spp r.time · denoise(img, albedo, normal, depth)

自然(nature, terrain)

h = terrain(384, kind="alpine"|"hills"|"mesa"|"island"|"dunes", seed, erosion=1, flow=False)   # 侵食されたハイトマップ[0,1]; erode() thermal()
c.terrain_map(h, style="relief"|"topo"|"shaded", water=.2)
v = c.landscape(h, cam=(x, alt, z), yaw, fov, horizon=.58, sun_elev=10, sun_az=30, haze=1, clouds=.35, water=.1, waves=.02, snow=.7, seed)
    v.depth v.water v.project(x, y, z) -> (px, py, px_per_m) v.ground(x, z)   # 3D地形に2Dの木を配置
c.sky(sun_elev=8, sun_az=0, horizon=.6, clouds=.3, haze=1) · c.sea(sun_elev=6, waves=.12, wave_len=60, foam=.5, clouds=.25)
c.tree(x, y, height_px, kind="oak"|"pine"|"birch"|"palm"|"bush"|"dead", season="summer"|"spring"|"autumn"|"winter", haze=0..1, seed)
c.grass(x, y, w, h, n) c.flower(x, y, size, kind="daisy"|"poppy"|"tulip"|"bell") c.fern(x, y, size) · tree3d("oak", 4, seed) → (trunk, leaves) SDF
scene_sky(s, sun_elev, sun_az)   # 3Dシーン上の物理的な空
c.anime_cloud(x, y, w, h=.55w, palette="day"|"sunset"|"dusk"|"storm"|(shadow,mid,light,rim), light=(az, elev), bands=3, rim=.7, wisps, edge, bottom, seed)  # セルシェーディング積雲、(x, y)に平らな底面
c.anime_tree(x, y, height, kind="round"|"tall"|"umbrella", palette="summer"|"spring"|"autumn"|"sakura"|"dusk"|(sh,mid,lt,rim,trunk), light, width, leafy=.6, seed)  # セルシェーディング木
c.anime_mountains(y_foot, height, peaks=4, x0, x1, palette="day"|"dusk"|"autumn"|(sh,mid,lt,snow,snow_sh,haze), light, snow=.35, haze=.6, sharp=1, depth=.35, bands=3, seed)  # 侵食された起伏、正面図、セルトーン
c.sparkles(n, region=mask, size=(6, 16), color, rays=4, glow=.6, seed)   # 星のきらめき(水面、雪)

フィギュア(figure)— 足が(x, y)、高さ=立ったときのpx(動物: 肩高)

c.figure(x, y, h, pose="stand", style="flat"|"line"|"silhouette"|"stick"|"ink"|"chalk", kind="human"|"cat"|"dog"|"horse"|"bird", seed)
   ポーズ: stand idle walk run sit wave point cheer jump dance think hips phone reach · phase=0-1(歩行サイクル) view="front"|"3q"|"side"|"back"
   body=adult|teen|child|elder build=slim|heavy outfit="tee pants|coat skirt|dress" hair=short|bob|long|bun|curly skin=SKIN name colors={...}
figure_shape(...) → Shape · figure_joints(...) → {"hand_r": (x, y), ...}(小道具を付ける) · figure_sdf(pose, height=1.75, style="mannequin")
c.crowd(n, box=(x0, y0, x1, y1), horizon=y, height=near_px, tint=(haze, .5), dogs=.1, seed)   # 遠近感調整済み群衆

検査(inspect)— 縮小ビューだけでなく、数値で判断

m = metrics(c|path|arr)   # noise(<1 クリーン、>4 粒状)aliasing(% ハードステップ、>35 ギザギザ)banding clip_shadows/highlights flags[...]
contact_sheet(c, "sheet.jpg") · compare(a, b, "ab.jpg") · guides(c) / composition(c) → focal, balance, tilt · analyze_reference("ref.jpg")

スタイル — シーンを書く前に該当ガイドを読む

ガイドはこのファイルの隣の styles/ にあります(なければ: https://raw.githubusercontent.com/Wexop/atelier/main/styles/<name>.md)。 それぞれレシピ、ルール、落とし穴、サンプルスクリプトを提供。複数を混ぜられます(例: anime + flat)。

  • anime.md — 塗り絵風アニメ風景: セル雲、木、山、リムライト、ゴッドレイ、スパークル
  • oil.md — 油彩(paint_like)と水彩ウォッシュ
  • photoreal.md — パストレースの静物/プロダクト、地形風景、海と空
  • comic.md — クリアライン/3Dからのトーン、彫刻、インクフィルター
  • flat.md — フラットベクター、ポスター、タイポグラフィ、人物、シルエットシーン
  • pixel.md — パレットとディザリングを使ったピクセルアート
  • abstract.md — ワープフィールドからのジェネラティブ抽象
  • new-style.md — 該当ガイドなし: ルックを研究し、プリミティブにマッピング、ペイントし、新しい styles/<name>.md として保存

落とし穴

  • c.layer() は現在のターゲットを変更: 後続の c.text/... はそのレイヤーに行く(multiply の場合は問題)。c.layer() または c.use(L) を呼び出すこと。
  • c.apply() は全レイヤーをマージする。レイヤーを維持するには L.apply() を使用。
  • shade(strength) はフィールドの周波数に依存: 大きな形状では≈1、細かいテクスチャ(布地)では≈.05。
  • 2Dアートに tone_map をかけると純白がグレーになる — HDR/3D用; イラストには curves/levels を使用。
  • ハードしきい値はエイリアシングを引き起こす: 目に見えるエッジには aastep/smoothstep を使用し、f > .5 は避ける。
  • ノイズ scale = キャンバス高さあたりの特徴数。シェイプ座標 = キャンバスpx;フィールド座標 = 0–1。
  • コスト: pathtrace ≈ 30–60 µs/パス(1200×800 @ 8 spp ≈ 2コアで約5分、プレビューは4分の1のspp) — c.render でドラフト; 低sppでは光沢金属/ガラスにきらめき(sppを上げる)。 aa=2 ≈ 4倍。多くのSDFパーツ(フィギュア、tree3d、displace)はトレースが遅い。
  • ガラス: rough=0 で透明(デフォルト rough .5 = 曇り)。 c.render ではガラスは一度屈折;実際の屈折には pathtrace を使用。

…

[翻訳のため省略]

関連スキル