Pigment/README.md

123 lines
2.9 KiB
Markdown
Raw Normal View History

2025-10-10 22:05:07 +02:00
2025-10-11 09:13:32 +02:00
<h1 align=center><img src="./src/assets/icon.png" height=64><br>Pigment</h1>
2025-10-10 22:05:07 +02:00
2025-10-10 22:16:16 +02:00
<p align=center>Use Godot's GLSL dialect for color grading and more.</p>
2025-10-10 22:05:07 +02:00
2025-10-11 09:13:32 +02:00
![screenshot](./screenshot.png)
2025-10-10 22:05:07 +02:00
## Table of Contents
- [Supported Platforms](#supported-platforms)
- [Usage](#usage)
- [Shaderlib](#shaderlib)
- [Commandline interface](#commandline-interface)
- [Known Issues](#known-issues)
## Supported Platforms
- Linux
2025-10-11 10:01:37 +02:00
- Windows
2025-10-10 22:05:07 +02:00
You can find the latest release ...
- [here (remotebranch.eu)](https://remotebranch.eu/ChaoticByte/Pigment/releases/latest)
2025-10-11 10:01:37 +02:00
- [and here (github.com)](https://github.com/ChaoticByte/Pigment/releases/latest)
2025-10-10 22:05:07 +02:00
## Supported Image Formats
| Format | Import | Export | Notes |
| ------ | :----: | :----: | ----- |
| PNG | ✔ | ✔ | exports to 8-bit RGBA |
| JPEG | ✔ | | |
| WEBP | ✔ | | |
2025-10-10 22:05:07 +02:00
## Usage
2025-10-10 23:31:01 +02:00
With Pigment, you process images by writing Shader code using Godot's GLSL dialect: GDShader.
2025-10-10 22:05:07 +02:00
If you want to learn GDShader, take a look at the [Godot docs](https://docs.godotengine.org/en/stable/tutorials/shaders/).
2025-10-10 23:31:01 +02:00
To get started, use the project template (see the Releases section of this repo) and open it in Godot. The template includes examples that you can use as a starting-point to write your own stuff.
2025-10-10 22:05:07 +02:00
2025-10-10 23:31:01 +02:00
After opening the project in Godot, start Pigment and open a `.gdshader` file & an image. Edit the shader using Godots `Shader Editor`, and hit `Apply` in Pigment.
2025-10-10 22:05:07 +02:00
## Shaderlib
This repo comes with a (still small) shader library including pre-written functions and more.
Have a look at the `shaderlib` folder.
Here is an example:
```glsl
shader_type canvas_item;
#include "./shaderlib/oklab.gdshaderinc"
void fragment() {
vec4 oklab = rgb2oklab(COLOR);
vec4 oklch = oklab2oklch(oklab);
oklch.z -= 2.0;
COLOR = oklab2rgb(oklch2oklab(oklch));
}
```
## Commandline interface
You can run Pigment from the commandline or scripts.
> Note: Headless mode is not supported. Using the commandline interface still opens a window.
### Usage
```
~ Pigment CLI ~
2025-10-10 22:16:16 +02:00
-=============-
2025-10-10 22:05:07 +02:00
Usage:
./Pigment <command> <args...>
Commands:
help
| Shows this help text.
apply --shader PATH --input PATH --output PATH
| Applies a shader file.
2025-10-10 22:16:16 +02:00
--shader PATH The path to the shader
--input PATH The path to the image
Passing a folder activates batch mode
--output PATH Where to write the resulting image to
In batch mode, this must be a folder
2025-10-10 22:05:07 +02:00
```
### Batch Mode
2025-10-10 22:16:16 +02:00
You can pass a directory to `--input` and `--output`. This will process all images in the input directory and write the output to the output directory.
2025-10-10 22:05:07 +02:00
2025-10-10 22:16:16 +02:00
> Note: This is not very fast, so using it on maaany images may take some time.
2025-10-10 22:05:07 +02:00
#### Examples
```
./Pigment apply --shader ./examples/oklab.gdshader --input ~/Pictures/test.png --output ./output.png
```
## Known Issues
2025-10-10 22:16:16 +02:00
- On some systems, screen scaling could lead to an either blurry UI, or no scaling at all
- CLI: Godot's `--headless` option is not supported