Community图像github.com

Dither – 图片抖动与半色调处理工具

将照片或图片转换为抖动、半色调或位图风格的图形(支持 Floyd‑Steinberg、Atkinson、Bayer、半色调网点、双色调、Risograph 风格色彩),输出 PNG 或 SVG 格式,适用于屏幕显示或印刷。

Dither – 图片抖动与半色调处理工具 是什么?

这是一个由 `scripts/dither.py` 驱动的专业图像抖动工具,专为需要将图像转化为 1‑bit 位图、旧 Mac 风格、半色调报纸效果、Riso 印刷感、丝网印刷或雷射雕刻/绘图仪用的开发者与设计师打造。它提供 14 种抖动算法(包括 Floyd‑Steinberg、Atkinson、Bayer、半色调网点、随机噪声等),支持双色调、灰度级以及基于调色板的彩色抖动(如 Riso 预设),并允许精细控制输出宽度、缩放比例、网点形状和角度。AI 代理可通过“先制作接触印相表 → 挑选方法 → 渲染最终结果”的工作流高效输出,并支持 PNG 和 SVG 格式。该工具在 Claude Code、Cursor 等终端或脚本环境中均可直接使用,核心优势在于其灵活的参数组合和视觉调试能力。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Remicht0/graphic-design-skills/tree/HEAD/skills/dither

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

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Dither – 图片抖动与半色调处理工具 是做什么的?

使用 scripts/dither.py 可将任何图像转换为抖动或半色调位图。脚本负责像素处理;你的工作是选择方法、点径和调色板,使结果在最终尺寸下清晰可读,并在交付前进行视觉检查。

工作流程

  1. 获取图像及其用途。 它将用于何处:Instagram 帖子、海报、T 恤印花、雷射雕刻、网页主图?用途决定了点的大小和格式(参见“尺寸设定”)。
  2. 先制作接触印相表(当用户未指定方法时)。它会在大约一秒内并列渲染所有 14 种方法:
    python3 scripts/dither.py input.jpg --compare -o compare.png --width 320 --scale 2
    
    查看印相表,挑选 1–2 种适合图像和意图的方法。如果用户在场,向他们展示印相表。
  3. 以正确尺寸渲染最终结果,然后检查输出(打开 PNG)后再交付。确保人脸、文字和主体的边缘仍然可读。如果不行,请参阅“修复效果不佳的结果”。
  4. 交付文件时附带一行使用的设置(方法、宽度、调色板),以便用户请求变体。

选择方法

期望效果方法说明
经典有机颗粒感floyd-steinberg安全默认。添加 --serpentine 可消除对角线“蠕虫纹”。
旧 Mac / 编辑位图,冲击力强atkinson会丢失部分阴影和高光细节,因此对比度感觉更高。非常适合物体肖像和粗犷形状。
最平滑的渐变jjn、stucki、sierra宽卷积核,最适合天空和肤色渐变。
复古网格、像素艺术、游戏bayer4、bayer8有序模式:规则交叉阴影,非常图形化,平铺效果佳。也是动画中最稳定的(帧间无闪烁)。
报纸、Riso 印刷、丝网印刷halftone真实圆形、方形或线状网点,带网角(--dot、--angle、--cell)。
海报 / 模板threshold无抖动;配合 --contrast 使用。
颗粒感、复印噪声random使用 --seed 保证可重现输出。

调色板与颜色

  • 默认是纯黑白。--levels 4 提供 4 级灰度。
  • 双色调: 传递两种颜色,先墨后纸或相反均可(它们会按亮度排序):--palette "#1F2BD1,#F3F2EE"。这通常是最具“设计感”的结果:一种墨色印在近乎白色的纸上。
  • 预设: bw、gray4、gray8、rgb8、riso、newsprint、blueprint。运行 python3 scripts/dither.py --list 可列出它们。
  • 彩色抖动: --color --palette riso(或任意 3 个或更多十六进制颜色列表)以彩色方式抖动,通过光学方式混合调色板网点。最适合误差扩散方法和包含一种深色、一种浅色以及 2–3 种饱和色的调色板。

尺寸设定(常被搞错的部分)

--width 是横向的网点数量。网点越少 = 越大、越明显的像素。--scale 随后使用最近邻插值放大每个网点,使其保持完全清晰。

  • 屏幕: 最终像素宽度 ÷ 缩放比例 = 宽度。用于 1080 px Instagram 帖子的粗网点:--width 270 --scale 4。用于细颗粒感:--width 540 --scale 2。
  • 印刷: 首先决定可见的网点大小。对于一张 50 cm 宽、300 dpi(5906 px)、网点约 1 mm 的海报:--width 500 --scale 12(500 个网点 × 12 = 6000 px)。之后切勿使用平滑重采样对 PNG 进行放大:网点的边缘会变模糊。
  • 半色调 按输出分辨率工作:用 --width 指定最终像素尺寸(并设 --scale 1),用 --cell 以像素为单位设置网点间距。在 300 dpi 下,--cell 12 ≈ 25 线/英寸,是一种可见的“波普艺术”网屏;--cell 6 ≈ 50 线/英寸,是报纸效果。
  • SVG(-o out.svg)输出矢量方形,非常适合雷射雕刻、刻字机、绘图仪或无限缩放。保持 --width 较小(约低于 400),否则文件会变重;脚本会在超过 25 万个矩形时发出警告。

修复效果不佳的结果

  • 主体淹没在细节中 → 减少 --width 的激进程度,添加 --sharpen,或提高 --contrast 1.2。
  • 整体过暗(抖动常见问题)→ --gamma 1.3 或 --brightness 0.08。
  • Atkinson 中阴影被阻塞 → 切换至 floyd-steinberg 或使用 --gamma 提亮。
  • 杂乱背景与主体竞争 → 先裁剪,或在抖动前去除背景。
  • 白色主体在白纸上消失 → 添加 --invert 或选择更深的纸张颜色。

示例

# Instagram 方形,粗颗粒 Atkinson 双色调
python3 scripts/dither.py photo.jpg -o post.png -m atkinson --width 270 --scale 4 --palette "#111111,#E9E7E1"

# A3 海报(297 mm @ 300 dpi ≈ 3508 px),45° 圆形半色调网点
python3 scripts/dither.py photo.jpg -o poster.png -m halftone --width 3508 --cell 14 --angle 45

# Risograph 风格彩色
python3 scripts/dither.py photo.jpg -o riso.png -m floyd-steinberg --color --palette riso --width 600 --scale 2 --serpentine

# 用于雷射雕刻的矢量文件
python3 scripts/dither.py logo.png -o engrave.svg -m bayer4 --width 240

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

art-direction-analyzer

Break down the art direction of a live website — typography, color palette, grid and spacing, motion and interactions, imagery — by inspecting the rendered page (computed styles, screenshots, hover states), and save a structured reference file with screenshots for a design inspiration library. Use whenever the user wants to study, deconstruct, scrape or reverse-engineer a site's design, visual identity, UI or motion, save a site as a reference or moodboard entry, or asks "how did they do this" about a website — even without the word "analysis".

editorial-layout

Design editorial, magazine-style PDF layouts in HTML/CSS — briefs, reports, portfolios, zines, presentations, posters, Instagram carousels — on a 12-column print grid with extreme type scale, one accent color, bleeding images and varied compositions, then render to a print-ready PDF (with bleed) plus PNG previews and automatic layout checks. Use whenever the user wants a document, PDF, deck, booklet or boards that look designed rather than templated, or asks for a magazine, editorial or Swiss-style layout.

palette

Build, check and export color palettes — extract one from a photo or moodboard, generate tints and shades (50–950) or harmonies in OKLCH, check WCAG contrast, and export to CSS variables, Tailwind, design tokens, Adobe ASE (Illustrator/InDesign/Photoshop), GIMP/Krita GPL or a swatch sheet. Use whenever the user wants a color palette, a color scale, "colors that go with" something, a contrast or accessibility check, or swatches for a design tool.

print-preflight

Check a PDF before it goes to the printer — bleed, trim size, image resolution at placed size, embedded fonts, RGB vs CMYK vs spot colors, total ink coverage, hairlines, transparency, layers and annotations — and explain each problem with the fix for InDesign, Illustrator, Affinity, Canva or Figma. Use whenever the user is about to print something (flyer, poster, business card, book, zine, packaging) or asks "is my file OK for print", "why did the printer reject my file", or wants a PDF checked.

相关技能