Crates.io | pixelfix |
lib.rs | pixelfix |
version | 0.1.4 |
created_at | 2025-09-16 12:02:13.672197+00 |
updated_at | 2025-09-16 20:03:53.782718+00 |
description | Fix transparent pixels in PNG images by filling them with the nearest non-transparent pixel's color. |
homepage | |
repository | https://codeberg.org/hamhim/pixelfix |
max_upload_size | |
id | 1841535 |
size | 3,119,005 |
pixelfix-rs is a Rust implementation of Corecii’s Transparent Pixel Fix (pixelfix).
Here's some statistics compared to Corecii's project:
https://codeberg.org/hamhim/pixelfix-rs/raw/branch/main/repository/showcase.webm
Currently, only Windows and Linux (and NixOS) is formally supported. Pixelfix should theorethically work on MacOS as it is platform agnostic, you can look at the build instructions a little below if you want to use the program or install cargo to install pixelfix through it.
With the binaries, you can use it directly by defining it's path, or set it up to be accessible globally. Windows and Linux users can get a binary built by me from the Releases page on Codeberg.
Cargo is a package manager for Rust that installs packages and software ("crates") from crates.io. You can find instructions to install Cargo here.
After installation, you can run the following on any platform to install pixelfix globally:
cargo install pixelfix
This is really only recommended on MacOS because this also requires installing Rust alongside and build dependencies. Use other methods if you can.
Builds of pixelfix for Windows is provided in the Releases page on Codeberg.
Have pixelfix.exe
downloaded
Open the Run dialogue with Windows Key + R
Insert shell:sendto
as shown below
Press OK
or the Enter key, it should open a File Explorer window
Move the pixelfix.exe
binary to that directory
Done! You can use pixelfix on folders and files by right clicking on them and hovering over the "Send to" option, then selecting pixelfix.exe
. On Windows 11, you may have to click on Show more options to bring back the Windows 10 context menu.
I don't have builds for MacOS. You'll need to build yourself or install with cargo.
You can directly run the following command in your terminal to automatically install pixelfix and make it globally accessible.
curl -s https://cutely.strangled.net/pixelfix.sh | bash
If you're just using the Nix package manager (not NixOS), use the installation script above for the easiest setup.
For Nix users who prefer the flake approach:
# Install permanently to user profile
nix profile install github:hamhimdev/pixelfix-rs/main
# Use once without installing
nix run github:hamhimdev/pixelfix-rs/main -- image.png
# Replace with git+https://codeberg.org/hamhim/pixelfix-rs if you prefer to use Codeberg, however if you don't have proper ipv6 you might have trouble using this.
A flake is provided that you can use to install the program on NixOS systems:
flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pixelfix.url = "github:hamhimdev/pixelfix-rs/main";
# You can also use https://git.clickette.org/hamhim/pixelfix-rs, but GitHub will be faster and more reliable.
# If you prefer, you can replace this with Codeberg by using "git+https://codeberg.org/hamhim/pixelfix-rs/", however if you don't have proper ipv6 you might have trouble using this.
};
outputs = { self, nixpkgs, pixelfix }: {
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
{
environment.systemPackages = [
pixelfix.packages.x86_64-linux.default
];
}
];
};
};
}
Optionally, you can also add the system package directly in your configuration.nix
. To do so you will need to define the pixelfix input in the file parameters. On the top:
configuration.nix
{
config,
pkgs,
pixelfix,
...
}:
And then add it to your packages:
configuration.nix
{
environment.systemPackages = [
pixelfix.packages.${pkgs.system}.default
# ...
];
}
And to expose the pixelfix flake to your configuration.nix:
flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pixelfix.url = "github:hamhimdev/pixelfix-rs/main";
};
outputs = { self, nixpkgs, pixelfix }: {
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit pixelfix; }; # !!!
modules = [ ./configuration.nix ];
};
};
}
For Home Manager users:
home.nix
{ config, pkgs, ... }:
{
home.packages = [
inputs.pixelfix.packages.${pkgs.system}.default
];
}
Follow the instructions on the Rust language website to install Rust. You will also need Git; if you don't have it, get it here. Alternatively, you can download an archive file from Codeberg or GitHub.
Get the source code using one of the following methods:
a. Git (Recommended): Clone the repository.
git clone https://codeberg.org/hamhim/pixelfix-rs
A mirror exists on https://git.clickette.org/hamhim/pixelfix-rs and https://github.com/hamhimdev/pixelfix-rs. You can replace the url with this for the same result.
b. Direct Download: Download and extract the .zip
archive from Codeberg.
Navigate into the project directory:
cd pixelfix-rs
(Note: Codeberg should append the branch name of the repository if you download a zip or tarball archive, and GitHub should only use the name of the branch, in this case you need to use pixelfix-rs-main
or main
respectively.).
Build the project using Cargo:
cargo build --release
With Nix or NixOS you can also use:
nix build
Done! The executable will be in the target/release/
directory. For example: target/release/pixelfix
. If you built with nix, it should also be in result/bin/pixelfix
(symlink to nix directory of where it built pixelfix).
(Linux (and maybe macOS?) Only) You shouldn't have to, but you may need to make it executable using one of the following methods:
a. Using chmod
in the terminal
chmod +x target/release/pixelfix
b. Using your file manager
Most Linux file managers can often make a file executable. To do this, right-click the file, go to its Properties or Permissions, and check the box to Allow executing file as a program or a similar option.
On Dolphin, you can find the option by going into the file's properties and going to permissions to check "Allow executing file as program".
On Nemo, you can find the option by going into the file's properties and going to permissions to check "Allow executing file as program".
# Fix a single file
pixelfix image.png
# Fix multiple files
pixelfix image1.png image2.png
# Fix every PNG in a folder (recursive)
pixelfix path/to/folder
# Fix every PNG in multiple folders (recursive)
pixelfix path/to/folder1 path/to/folder2
# Debug mode (shows replaced pixels instead of leaving them transparent)
pixelfix -d image.png
I would recommend reading the last section of Corecii's repository, they have a great explaination for this.
The program is under the MIT License. The repository has the clause attached here.