pixelfix

Crates.iopixelfix
lib.rspixelfix
version0.1.4
created_at2025-09-16 12:02:13.672197+00
updated_at2025-09-16 20:03:53.782718+00
descriptionFix transparent pixels in PNG images by filling them with the nearest non-transparent pixel's color.
homepage
repositoryhttps://codeberg.org/hamhim/pixelfix
max_upload_size
id1841535
size3,119,005
hamhim (hamhimdev)

documentation

README

pixelfix logo

Pixelfix

pixelfix-rs is a Rust implementation of Corecii’s Transparent Pixel Fix (pixelfix).

Here's some statistics compared to Corecii's project:

  • 100–120x or 95%+ faster in my testing (shown below)
  • About 10x smaller in file size (due to being a compiled binary)
  • Works as a drop-in replacement

https://codeberg.org/hamhim/pixelfix-rs/raw/branch/main/repository/showcase.webm

Features

  • Fix one image, many images, or an entire folder (recursive)
  • Progress bar with ETA
  • FAST!!!

Installing

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 (All platforms)

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.

Windows

Release Binary

Builds of pixelfix for Windows is provided in the Releases page on Codeberg.

Cargo

See Cargo (All platforms).

Usage

Method 1 - Add pixelfix to the right click context menu "send to" feature on explorer
  1. Have pixelfix.exe downloaded

  2. Open the Run dialogue with Windows Key + R

  3. Insert shell:sendto as shown below

    Windows' Run dialogue, with shell:sendto inserted

  4. Press OK or the Enter key, it should open a File Explorer window

  5. Move the pixelfix.exe binary to that directory

  6. 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.

MacOS

I don't have builds for MacOS. You'll need to build yourself or install with cargo.

Cargo

See Cargo (All platforms).

Linux

Using an installation script (Recommended)

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

Cargo

See Cargo (All platforms).

Nix

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.

NixOS

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 ];
    };
  };
}

Home Manager

For Home Manager users:

home.nix

{ config, pkgs, ... }:
{
  home.packages = [
    inputs.pixelfix.packages.${pkgs.system}.default
  ];
}

Building

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.

  1. Get the source code using one of the following methods:

  2. 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.).

  3. Build the project using Cargo:

    cargo build --release
    

    With Nix or NixOS you can also use:

    nix build
    
  4. 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).

  5. (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.

      Dolphin (KDE Plasma)

      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".

      Dolphin inside KDE Plasma on the properties menu of pixelfix

      Nemo (Cinnamon)

      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".

      Nemo inside KDE Plasma on the properties menu of pixelfix

Usage

# 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

Why is this needed?

I would recommend reading the last section of Corecii's repository, they have a great explaination for this.

Licensing

The program is under the MIT License. The repository has the clause attached here.

Commit count: 0

cargo fmt