MCPcopy Index your code
hub / github.com/clroot/slimg

github.com/clroot/slimg @v0.5.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.1 ↗ · + Follow
1,029 symbols 2,389 edges 88 files 180 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

slimg

CI Crates.io PyPI Maven Central License: MIT MSRV

빠른 이미지 최적화 CLI. 최신 코덱을 사용하여 이미지를 변환, 압축, 리사이즈, 크롭, 확장합니다.

English

지원 포맷

포맷 디코딩 인코딩 비고
JPEG O O MozJPEG 인코더로 뛰어난 압축률
PNG O O OxiPNG + Zopfli 압축
WebP O O libwebp 기반 손실 압축
AVIF O O ravif 인코더; dav1d 디코더 (정적 링크)
QOI O O 무손실, 빠른 인코딩/디코딩
JPEG XL O O libjxl 인코더/디코더

설치

Cargo (crates.io)

cargo install slimg

Homebrew (macOS / Linux)

brew install clroot/tap/slimg

빌드된 바이너리

GitHub Releases에서 다운로드:

플랫폼 파일
macOS (Apple Silicon) slimg-aarch64-apple-darwin.tar.xz
macOS (Intel) slimg-x86_64-apple-darwin.tar.xz
Linux (x86_64) slimg-x86_64-unknown-linux-gnu.tar.xz
Linux (ARM64) slimg-aarch64-unknown-linux-gnu.tar.xz
Windows (x86_64) slimg-x86_64-pc-windows-msvc.zip

소스에서 빌드

git clone https://github.com/clroot/slimg.git
cd slimg
cargo install --path cli

빌드 요구사항

  • Rust 1.85+ (edition 2024)
  • C 컴파일러 (cc)
  • nasm (MozJPEG / rav1e 어셈블리 최적화용)
  • meson + ninja (dav1d AVIF 디코더 소스 빌드용)
  • SYSTEM_DEPS_DAV1D_BUILD_INTERNAL=always 설정으로 dav1d를 소스에서 빌드

사용법

상세 사용 가이드는 docs/usage.ko.md를 참고하세요.

# 포맷 변환
slimg convert photo.jpg --format webp

# 최적화 (같은 포맷으로 재인코딩)
slimg optimize photo.jpg --quality 70

# 리사이즈
slimg resize photo.jpg --width 800

# 좌표로 크롭
slimg crop photo.jpg --region 100,50,800,600

# 비율로 크롭 (중앙 기준)
slimg crop photo.jpg --aspect 16:9

# 여백 추가로 정사각형 만들기
slimg extend photo.jpg --aspect 1:1

# 투명 배경으로 확장
slimg extend photo.png --aspect 1:1 --transparent

# 배치 처리 + 포맷 변환
slimg convert ./images --format webp --output ./output --recursive --jobs 4

벤치마크

모든 코덱과 파이프라인 연산의 상세 성능 측정 결과는 docs/benchmarks.md를 참고하세요.

언어 바인딩

언어 패키지 플랫폼
Kotlin/JVM io.clroot.slimg:slimg-kotlin macOS, Linux, Windows
Python slimg macOS, Linux, Windows

라이브러리

핵심 기능은 라이브러리 크레이트(slimg-core)로도 사용 가능합니다:

use slimg_core::*;

// 이미지 파일 디코딩
let (image, format) = decode_file(Path::new("photo.jpg"))?;

// WebP로 변환
let result = convert(&image, &PipelineOptions {
    format: Format::WebP,
    quality: 80,
    resize: None,
    crop: None,
    extend: None,
    fill_color: None,
})?;

// 결과 저장
result.save(Path::new("photo.webp"))?;

라이선스

MIT

Extension points exported contracts — how you extend this code

Codec (Interface)
Trait implemented by each image codec (JPEG, PNG, WebP, etc.). [6 implementers]
crates/slimg-core/src/codec/mod.rs
FfiConverter (Interface)
* The FfiConverter interface handles converter types to and from the FFI * * All implementing objects should be public
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt
LoadedFile (Interface)
(no doc)
gui/src/App.tsx
FfiConverterRustBuffer (Interface)
* FfiConverter that uses `RustBuffer` as the FfiType * * @suppress */
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt
OptionsPanelProps (Interface)
(no doc)
gui/src/components/OptionsPanel.tsx
UniffiRustCallStatusErrorHandler (Interface)
* Each top-level error class has a companion object that can lift the error from the call status's rust buffer * * @su
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt
SettingsProps (Interface)
(no doc)
gui/src/components/Settings.tsx
UniffiRustFutureContinuationCallback (Interface)
Define FFI callback types
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt

Core symbols most depended-on inside this repo

write
called by 53
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt
read
called by 52
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt
allocationSize
called by 50
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt
decode
called by 31
bindings/kotlin/src/main/kotlin/io/clroot/slimg/Slimg.kt
convert
called by 30
bindings/kotlin/src/main/kotlin/io/clroot/slimg/Slimg.kt
cn
called by 24
gui/src/lib/utils.ts
lower
called by 23
bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt
resize
called by 21
bindings/kotlin/src/main/kotlin/io/clroot/slimg/Slimg.kt

Shape

Method 490
Function 328
Class 151
Interface 45
Enum 15

Languages

Kotlin46%
Rust29%
Python15%
TypeScript10%

Modules by API surface

bindings/kotlin/src/main/kotlin/io/clroot/slimg/slimg_ffi.kt344 symbols
bindings/python/slimg/_types.py45 symbols
bindings/kotlin/src/test/kotlin/io/clroot/slimg/SlimgTest.kt37 symbols
crates/slimg-core/src/format.rs31 symbols
bindings/python/tests/test_operations.py31 symbols
bindings/python/tests/test_format.py31 symbols
cli/src/commands/mod.rs29 symbols
bindings/kotlin/src/test/kotlin/io/clroot/slimg/SlimgImageTest.kt26 symbols
crates/slimg-ffi/src/lib.rs25 symbols
crates/slimg-core/src/extend.rs23 symbols
bindings/kotlin/src/test/kotlin/io/clroot/slimg/SlimgObjectTest.kt23 symbols
gui/src-tauri/src/commands.rs18 symbols

For agents

$ claude mcp add slimg \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact