Crates.io | pepecore |
lib.rs | pepecore |
version | 0.1.3 |
created_at | 2025-05-01 09:12:09.487991+00 |
updated_at | 2025-05-02 21:14:21.420149+00 |
description | A Rust library for image decoding, encoding, and processing using an efficient SVec data structure. |
homepage | |
repository | https://github.com/rewaifu/pepecore |
max_upload_size | |
id | 1656038 |
size | 150,050 |
A Rust library for image decoding, encoding, and processing using an efficient SVec
data structure.
PepeCore provides:
array::svec::SVec
).read::read_in_path
, read::read_in_buffer
).SVec
images to disk in common formats (save::svec_save
).cvt_color
.halftone
, rotate_halftone
).screentone
, rotate_screentone
).Add PepeCore to your Cargo.toml
:
[dependencies]
pepecore = "0.1"
Then in your crate:
extern crate pepecore;
use pepecore::{svec::SVec, read::read_in_path, save::svec_save};
use pepecore::{cvt_color, halftone, screentone};
use pepecore::enums::{ImgColor, CVTColor, DotType};
use pepecore::{
svec::SVec,
read::read_in_path,
save::svec_save,
cvt_color,
screentone,
enums::{ImgColor, CVTColor, DotType},
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Decode an image file as RGB
let mut img: SVec = read_in_path("input.jpg", ImgColor::RGB)?;
// 2. Convert RGB → Grayscale (BT.709)
cvt_color(&mut img, CVTColor::RGB2Gray_709);
// 3. Apply a screentone effect (dot pattern 8×8)
screentone(&mut img, 8, &DotType::Square);
// 4. Save the processed image
svec_save(img, "output.png")?;
Ok(())
}
u8
, u16
, or f32
data.Luma
, LumaA
, Rgb
, Rgba
in u8
, u16
, and f32
formats.u8
with simple scaling (×255
).Use cvt_color(&mut img, CVTColor::…)
to:
The color_levels
API is not yet fully implemented. Stay tuned for fine-grained black/white point and gamma adjustments.