﻿---
title: GoWall
date: 2025-06-20
cover: https://assets.vluv.space/cover/Ricing/神奈川冲浪里.webp
tags: [Wallpaper, Ricing, Catppuccin, CLI]
excerpt: "关注桌面个性化的可能对 Color Scheme / Palette 比较感兴趣，诸如Catppuccin、Nord等主题。GoWall 是一个非常有用的工具，可以帮助你将图片转换为特定的 Color Scheme"
---

> [Achno/gowall](https://github.com/Achno/gowall): A tool to convert a Wallpaper's color scheme / palette, image to pixel art, color palette extraction, image upsacling with Adversarial Networks and more image processing features
>
> - Convert Wallpaper's theme 👾 – Recolor an image to match your favorite + (Custom) themes (Catppuccin...)
> - AI Image Upscaling - Increase the resolution of the image while preserving or improving its quality.
> - Support for Unix pipes/redirection - Read from stdin and write to stdout
> - Convert Icon's theme (svg,ico) - Recolor your icons to match a theme
> - Image to pixel art - Transforms your image to the typical blocky appearance of pixel art.
> - Replace a specific color in an image - pretty self explanatory.
> - Create a gif from images - use the images as frames and specify a delay and the number of loops.
> - Extact color palette - Extracts all the dominant colors in an image (like pywal)
> - Change Image format - Ex. change format from .webp to .png.
> - Invert image colors - pretty self explanatory.
> - Draw on the Image - Draw borders,grids on the image
> - Remove the background of the image - pretty self explanatory.
> - Effects - Mirror,Flip,Grayscale,change brightness and more to come!
> - Daily wallpapers - Explore community-voted wallpapers that reset daily.

![invert](https://github.com/Achno/gowall/raw/main/assets/invert.png)

> [!WARNING]
>
> 目前不支持`svg`格式的图片转换, 需自行进行格式的转换
> [SVG to PNG Converter - FreeConvert.com](https://www.freeconvert.com/svg-to-png)

## Installation

参考下面文档完成安装

[installation | Gowall Docs](https://achno.github.io/gowall-docs/installation)

> [!WARNING]
>
> 以 MacOS 为例，建议在 GitHub Release 下载`v0.2.1`的二进制文件，`homebrew`目前（2025.6.20）的最新版为`v0.2.0`，存在一些 bug

## Scripts

个人经常使用 GoWall 转换图片的 Color Scheme，在提交到 Repo/ImageBed 前通常会转成`webp`格式，对应的命令如下：

```shell
gowall convert ./img/cover.jpg -t catppuccin --output ./cover.webp
```

重复键入命令比较麻烦，且 nushell 目前没有`gowall`的自动补全，这里提供一个脚本来简化操作。

```bash
#!/bin/bash

# Ref: [installation | Gowall Docs](https://achno.github.io/gowall-docs/installation)

# 检查参数数量
if [ $# -ne 1 ]; then
  echo "用法: $0 <图片文件路径>"
  echo "示例: $0 ./img/cover.jpg"
  exit 1
fi

# 获取输入文件路径
input_file="$1"

# 检查文件是否存在
if [ ! -f "$input_file" ]; then
  echo "错误: 文件 '$input_file' 不存在"
  exit 1
fi

# 获取文件名（不含路径和扩展名）
filename=$(basename "$input_file")
filename_no_ext="${filename%.*}"

# 构建输出文件路径（当前工作目录 + 文件名 + .webp）
output_file="$(pwd)/${filename_no_ext}.webp"

# 执行gowall命令
echo "正在转换: $input_file -> $output_file"
gowall convert "$input_file" -t catppuccin --output "$output_file"

# 检查命令执行结果
if [ $? -eq 0 ]; then
  echo "✅ 转换成功: $output_file"
else
  echo "❌ 转换失败"
  exit 1
fi
```

**Usage**

```bash
# 赋予脚本执行权限
chmod +x mocha_it
# 将脚本放在PATH中，例如：~/bin/mocha_it，个人是存在到`~/dotfiles/bin/`目录下
export PATH="$PATH:~/dotfiles/bin"
# 执行脚本
mocha_it ./img/cover.jpg
```
