#color-palette #png #image #static #output #input-output #crayon

bin+lib dither

具有多种调色板的静态图像抖动器

22 个版本 (稳定版)

1.3.10 2021 年 5 月 5 日
1.3.9 2020 年 11 月 2 日
1.3.8 2020 年 9 月 4 日
1.3.7 2019 年 10 月 7 日
0.2.1 2019 年 1 月 30 日

#373 in 图像

Download history 11/week @ 2024-03-08 4/week @ 2024-03-15 189/week @ 2024-03-29 37/week @ 2024-04-05 4/week @ 2024-04-19 4/week @ 2024-04-26

每月 121 次下载

MIT 许可证

595KB
994

Dither 1.3.10

灵感来源于: http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/

许可证:MIT

测试照片( "bunny.png" )是在创意共享许可证下获得的,属于公共领域。

安装

  • 从源代码编译

    • 按照 rustup.rs/ 的说明安装 rust

    • 安装 dither

        cargo install dither
      
  • 下载二进制文件(x64-windows, x64-linux)

  • 通过 Docker 直接运行

      docker run efronlicht/dither:latest
    

CLI 帮助

dither --help

用法

dither INPUT [OUTPUT] [-v] [--dither="floyd"] [--color="bw"] [--depth="1"] [--help]

示例

# no-op

bunny

dither bunny.png burkes.png --dither=burkes

burkes

dither bunny.png crayon.png --color=crayon

crayon

参数

INPUT

输入图像的路径。已知良好的图像格式是 .png.jpg

OUTPUT

输出路径。如果需要,将在现有位置创建或截断文件。图像类型将根据文件名推断。目前,仅支持 .png.jpg

-c , --color

要使用的颜色模式。默认是 "bw"(黑白)。可用选项包括

  • bw(默认)
  • color
  • cga
  • crayon
  • $COLOR
  • $FILENAME

--color=bw(默认)

灰度模式。将抖动到 --depth 位;--depth=1 使用纯黑白,--depth=2 使用黑白和两种灰度,等等。

color=color

使用指定位深的 RGB 通道。即,--color=color, --depth=2 为红色、绿色和蓝色通道各使用两个位。

--color=crayon

使用蜡笔颜色调色板。详细信息请见 "crayon.plt"。

--color=cga

使用 cga 颜色调色板。请参考维基百科文章或 "cga.plt" 获取详细信息。

--color=$颜色

单色模式。将黑白以指定位深度进行抖动,然后用给定颜色替换白色,背景使用黑色。

  • 蓝色
  • 绿色
  • 青色
  • 红色
  • 品红色
  • 棕色
  • 浅灰色
  • 灰色
  • 浅蓝色
  • 浅绿色
  • 浅青色
  • 浅红色
  • 浅品红色
  • 黄色
  • 白色

--color=$FILENAME

从文件中加载调色板。调色板指定为一组由换行符分隔的24位十六进制数列表,可选的0x前缀。请参考 crayon.pltcga.plt 获取示例。

// WHITE
0xffffff
// BLACK
0x000000
// RED
0xff0000
// GREEN
0x00ff00
// BLUE
0x0000ff

-d, --dither

要使用的抖动器类型。可用选项有

  • "floyd" , "steinberg" , "floydsteinberg" (默认)
  • "atkinson" ,
  • "stucki" ,
  • "burkes" ,
  • "jarvis" , "judice" , ninke"
  • "sierra" , "sierra3"

请参阅 文档Tanner Helland 的文章 获取技术细节。

-v, --详细模式

将详细调试输出到标准错误。

--depth

将每个通道压缩到的位深度。应该是介于1和7之间的无符号整数(默认为1)。与 --color= $FILENAMEcolor==cga--color=crayon 选项互斥。

依赖关系

~14MB
~78K SLoC