Skip to content

Commit

Permalink
release/v0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
inflation committed Sep 27, 2024
1 parent f4cdb5b commit d964913
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 122 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 0 additions & 113 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
37 changes: 37 additions & 0 deletions jpegxl-rs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.11.0+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-rs-v0.10.4+libjxl-0.10.3...jpegxl-rs-v0.11.0+libjxl-0.11.0) - 2024-09-27

### Added

- Update JPEG quality setting in encoder ([#74](https://github.com/inflation/jpegxl-rs/pull/74))

### Fixed

- Update release configuration for jpegxl-rs and jpegxl-sys packages
- Change ffi function types to use `c-unwind` ABI

### Other

- Convert `libjxl` doc to rustdoc format with help from @copilot
- Move `libjxl` functions into modules
- Bump thiserror from 1.0.63 to 1.0.64
- Bump pretty_assertions from 1.4.0 to 1.4.1
- Remove unnecessary feature attribute in thread pool implementations
- Remove threads feature and update dependencies.
- Don't use -sys in -rs with default features enabled
- Bump derive_builder from 0.20.0 to 0.20.1
- Change JxlBoxType to use system char type
- Update how docs are generated ([#73](https://github.com/inflation/jpegxl-rs/pull/73))
- ⬆️ (deps): Bump thiserror from 1.0.62 to 1.0.63 ([#66](https://github.com/inflation/jpegxl-rs/pull/66))
- :arrow_up: (deps): Bump testresult from 0.4.0 to 0.4.1
- :arrow_up: (deps): Bump image from 0.25.1 to 0.25.2
- :arrow_up: (deps): Bump thiserror from 1.0.61 to 1.0.62
- Update release-plz workflow and config
4 changes: 2 additions & 2 deletions jpegxl-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later"
name = "jpegxl-rs"
readme = "README.md"
repository = "https://github.com/inflation/jpegxl-rs"
version = "0.10.4+libjxl-0.10.3"
version = "0.11.0+libjxl-0.11.0"
rust-version.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -35,7 +35,7 @@ half = "2.4.1"
byteorder = "1.5.0"

[dependencies.jpegxl-sys]
version = "0.10.4"
version = "0.11.0"
path = "../jpegxl-sys"
default-features = false

Expand Down
1 change: 0 additions & 1 deletion jpegxl-rs/README.md

This file was deleted.

113 changes: 113 additions & 0 deletions jpegxl-rs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# jpegxl-rs

[![Documentation](https://docs.rs/jpegxl-rs/badge.svg)](https://docs.rs/jpegxl-rs/)
[![Crates.io](https://img.shields.io/crates/v/jpegxl-rs.svg)](https://crates.io/crates/jpegxl-rs)
[![dependency status](https://deps.rs/repo/github/inflation/jpegxl-rs/status.svg)](https://deps.rs/repo/github/inflation/jpegxl-rs)
[![CI](https://github.com/inflation/jpegxl-rs/workflows/CI/badge.svg)](https://github.com/inflation/jpegxl-rs/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/inflation/jpegxl-rs/branch/master/graph/badge.svg?token=3WMRUQ816H)](https://codecov.io/gh/inflation/jpegxl-rs)
[![License: GPL-3.0-or-later](https://img.shields.io/crates/l/jpegxl-rs)](https://github.com/inflation/jpegxl-rs/blob/master/LICENSE)

A safe JPEGXL wrapper over `libjxl` library. Check out the original [library](https://github.com/libjxl/libjxl)
and the [bindings](https://github.com/inflation/jpegxl-rs/tree/master/jpegxl-sys).

## Building

If you wish to specify a custom library path, set the `DEP_JXL_LIB` environment variable.

Building `libjxl` and statically linking can be enabled by using the `vendored` feature.

If you don't want to depend on C++ standard library, disable the feature `threads`.

## Usage

Currently, `u8`, `u16`, `f16` and `f32` are supported as pixel types.

### Decoding

```rust
use jpegxl_rs::*;
use jpegxl_rs::decode::*;

let mut decoder = decoder_builder().build().unwrap();
let sample = include_bytes!("../../samples/sample.jxl");

let (Metadata { width, height, ..}, pixels) = decoder.decode(sample).unwrap();
match pixels {
Pixels::Float(data) => { /* do something with Vec<f32> data */ },
Pixels::Uint8(data) => { /* do something with Vec<u8> data */ },
Pixels::Uint16(data) => { /* do something with Vec<u16> data */ },
Pixels::Float16(data) => { /* do something with Vec<f16> data */ },
}

// Multi-threading
use jpegxl_rs::ThreadsRunner;
let runner = ThreadsRunner::default();
let mut decoder = decoder_builder()
.parallel_runner(&runner)
.build()
.unwrap();

// Customize pixel format
let mut decoder = decoder_builder()
.pixel_format(PixelFormat {
num_channels: 3,
endianness: Endianness::Big,
align: 8
})
.build()
.unwrap();

decoder.decode_with::<u8>(sample);

// You can change the settings after initialization
decoder.skip_reorientation = Some(true);

// Reconstruct JPEG, fallback to pixels if JPEG reconstruction is not possible
// This operation is finished in on pass
let (metadata, data) = decoder.reconstruct(sample).unwrap();
match data {
Data::Jpeg(jpeg) => {/* do something with the JPEG data */}
Data::Pixels(pixels) => {/* do something with the pixels data */}
}
```

### Encoding

```rust
use image::ImageReader;
use jpegxl_rs::encoder_builder;
use jpegxl_rs::encode::{EncoderResult, EncoderSpeed};

let sample = ImageReader::open("../samples/sample.png").unwrap().decode().unwrap().to_rgba16();
let mut encoder = encoder_builder().build().unwrap();

let buffer: EncoderResult<f32> = encoder.encode(&sample, sample.width(), sample.height()).unwrap();

// Set encoder options
let mut encoder = encoder_builder()
.lossless(true)
.speed(EncoderSpeed::Falcon)
.build()
.unwrap();

// You can change the settings after initialization
encoder.lossless = false;
encoder.quality = 3.0;
```

### [`image`](https://crates.io/crates/image) crate integration

The integration is enabled by default. If you don't need it, disable `image` feature.

```rust
use jpegxl_rs::image::ToDynamic;
use jpegxl_rs::decoder_builder;
use image::DynamicImage;

let sample = std::fs::read("../samples/sample.jxl").unwrap();
let mut decoder = decoder_builder().build().unwrap();
let img = decoder.decode_to_image(&sample).unwrap();
let img = decoder.decode_to_image_with::<f32>(&sample).unwrap();
```

License: GPL-3.0-or-later
2 changes: 1 addition & 1 deletion jpegxl-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ along with jpegxl-rs. If not, see <https://www.gnu.org/licenses/>.

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![doc = include_str!("../../README.md")]
#![doc = include_str!("../README.md")]

#[macro_use]
extern crate derive_builder;
Expand Down
14 changes: 14 additions & 0 deletions jpegxl-src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.11.1](https://github.com/inflation/jpegxl-rs/compare/jpegxl-src-v0.10.5...jpegxl-src-v0.11.1) - 2024-09-27

### Other

- release/v0.11.0
2 changes: 1 addition & 1 deletion jpegxl-src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "BSD-3-Clause"
name = "jpegxl-src"
readme = "README.md"
repository = "https://github.com/inflation/jpegxl-rs"
version = "0.11.0"
version = "0.11.1"
rust-version.workspace = true
exclude = [
"libjxl/third_party/libpng",
Expand Down
5 changes: 5 additions & 0 deletions jpegxl-src/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn main() {
let source = std::path::Path::new("libjxl");
assert!(source.exists());
assert!(source.is_dir());
}
29 changes: 29 additions & 0 deletions jpegxl-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.11.0+libjxl-0.11.0](https://github.com/inflation/jpegxl-rs/compare/jpegxl-sys-v0.10.4+libjxl-0.10.3...jpegxl-sys-v0.11.0+libjxl-0.11.0) - 2024-09-27

### Added

- Add gain map utility functions

### Fixed

- Update release configuration for jpegxl-rs and jpegxl-sys packages
- Change ffi function types to use `c-unwind` ABI

### Other

- Convert `libjxl` doc to rustdoc format with help from @copilot
- Move `libjxl` functions into modules
- Bump pkg-config from 0.3.30 to 0.3.31
- Bump pretty_assertions from 1.4.0 to 1.4.1
- Remove threads feature and update dependencies.
- Update how docs are generated ([#73](https://github.com/inflation/jpegxl-rs/pull/73))
- :arrow_up: (deps): Bump image from 0.25.1 to 0.25.2
2 changes: 1 addition & 1 deletion jpegxl-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ links = "jxl"
name = "jpegxl-sys"
readme = "README.md"
repository = "https://github.com/inflation/jpegxl-rs"
version = "0.10.4+libjxl-0.10.3"
version = "0.11.0+libjxl-0.11.0"
rust-version.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down

0 comments on commit d964913

Please sign in to comment.