Give your images a pixel art-like style and reduce the file size in the process with Halftone.
Halftone is a simple Libadwaita app for lossy image compression using quantization and dithering techniques.
Because it's fun! And it can also significantly reduce image size.
What is that dithering?
Dithering is a technique used by old systems with a limited color range to more accurately display graphics containing higher amount of colors than what the device can handle. It was commonly used in early Macintosh computers, Nintendo Game Boy and many other systems from the 80s and 90s.Check out this↗ article which nicely explains how dithering argorithms works (warning, math!) and shows most popular dithering algorithms in action.
- Three different dither algorithms: You can choose between the classic Floyd-Steinberg algorithm, interesting Riemersma and Bayer (a.k.a ordered) dither known from the Game Boys.
- Live preview: Check out how your image will look like in real time with live preview feature.
- Convert to many formats: In addition to dithering, you can convert your images to different formats to save up some space on disk.
- It's just that simple. Everything is as simple as possible, so that you could start dithering your images as soon as you're done installing the app.
You can install Halftone in many ways, here are some listed:
1. Official Flatpak package (Not yet available):
2. Alternative package distributions:
Warning Although some of the methods listed here may be maintained by the Halftone maintainers, these methods are not officially supported and issues related to packaging in them should be reported outside this project's bug tracker.
3. Install from source:
If you don't find any other options appealing to you, then you can always compile code on your machine from source and install it that way. For more information, check out How to build? section.
Thanks for asking! Just for you, I've created this list of things you need to do if you want to contribute to Halftone:
- Read Code of Conduct
- Fork this repository: https://github.com/tfuxu/Halftone/fork
- Clone your fork:
git clone https://github.com/👁️you👁️/Halftone.git
- Create a local branch with your changes:
git checkout -b new-thingies
- When changing stuff in Python, try to follow PEP8
- Commit your changes:
git commit
- Push the changes to fork:
git push origin new-thingies
- Create a new pull request
This is the easiest way of building Halftone if you want to build it as a Flatpak package. Highly recommended, but probably not for everyone, as GNOME Builder and Flatpak can be quite resource hungry.
- Download GNOME Builder.
- In Builder, click the Clone Repository button at the bottom, using
https://github.com/tfuxu/Halftone.git
as the URL. - Click the Build button at the top once the project is loaded.
This is a little bit more advanced way of building Flatpak packages, but if you don't want or can't have GNOME Builder, then this method would be your best bet.
- Flatpak Builder
flatpak-builder
- GNOME SDK runtime
org.gnome.Sdk//44
- GNOME Platform runtime
org.gnome.Platform//44
Install required runtimes:
flatpak install org.gnome.Sdk//44 org.gnome.Platform//44
git clone https://github.com/tfuxu/Halftone.git
cd Halftone
flatpak-builder --install --user --force-clean repo/ build-aux/flatpak/io.github.tfuxu.Halftone.json
git clone https://github.com/tfuxu/Halftone.git
cd Halftone
flatpak-builder --install --system --force-clean repo/ build-aux/flatpak/io.github.tfuxu.Halftone.json
If you don't want to install Halftone as a Flatpak package, you can build it using Meson build system. Meson is used in majority of GTK apps and enforced on GNOME core apps, so learning how to use it would be pretty handy if you plan to contribute to other GTK projects.
The following packages are required to build Halftone:
- Python 3
python
- PyGObject
python-gobject
- Blueprint
blueprint-compiler
- GTK 4
gtk4
- Libadwaita (>= 1.2.0)
libadwaita
- Imagemagick
imagemagick
- Meson
meson
- Ninja
ninja-build
Required Python libraries:
pip install -r requirements.txt
git clone https://github.com/tfuxu/Halftone.git
cd Halftone
meson setup builddir
meson configure builddir -Dprefix=/usr/local
sudo ninja -C builddir install
git clone https://github.com/tfuxu/Halftone.git
cd Halftone
meson setup builddir
meson configure builddir -Dprefix="$(pwd)/builddir"
ninja -C builddir install
ninja -C builddir run
Note During testing and development, as a convenience, you can use the
local.sh
script to quickly rebuild local builds.
This repository is licensed under the terms of the GNU GPLv3 license. You can find a copy of the license in the COPYING file.
This project was started after I found out about Pixfect, a little Bash script that does exactly what Halftone does.
The user interface design is based on Converter style, with itself is based on Upscaler design.
This README (mostly How to Build? section) is based on Gradience README.