Thanks to visit codestin.com
Credit goes to lib.rs

#image #gimp

xcf-rs

A basic standalone GIMP XCF library in Rust

1 unstable release

Uses new Rust 2024

0.5.0 Jun 8, 2025

#926 in Images

Unlicense

63KB
1.5K SLoC

XCF File Reader

Latest Version

Designed for extracting layer and pixel data from XCF files.

I originally made this as part of an art pipeline for a game idea, as such it's missing support for a lot of features (I only needed to pluck pixel data from a few layers).

  • results are always returned in RGBA pixels, regardless of original format
  • supports RGB or RGBA images, but not grayscale or indexed
  • XCF files with better compression are not supported (there is an ignored failing test for this, should someone like to add support)

Contributions welcome.

Documentation

https://testing.developer.gimp.org/core/standards/xcf/

Use of

Example

extern crate xcf;
use xcf::Xcf;

fn main() {
    let mut rdr = File::open("untitled.xcf")
        .expect("Failed to open file.");
    let raw_image = Xcf::load(&mut rdr)
        .expect("Failed to parse XCF file.");

    // or simpler yet:
    let raw_image = Xcf::open("untitled.xcf")
        .expect("Failed to open and parse XCF file.");
}

Credits

This soft is initially a fork of https://github.com/shivshank/xcf-rs

Dependencies

~2MB
~45K SLoC