#jpeg #image #decoder #encoder #transform

turbojpeg

Fast and easy JPEG encoding, decoding and lossless transforms with TurboJPEG

9 releases (4 breaking)

Uses new Rust 2021

0.5.0 Jun 26, 2022
0.4.3 Jun 16, 2022
0.4.2 Apr 9, 2022
0.3.0 Feb 21, 2022
0.1.0 May 2, 2021

#61 in Images

Download history 151/week @ 2022-03-17 84/week @ 2022-03-24 150/week @ 2022-03-31 182/week @ 2022-04-07 88/week @ 2022-04-14 87/week @ 2022-04-21 144/week @ 2022-04-28 142/week @ 2022-05-05 226/week @ 2022-05-12 110/week @ 2022-05-19 178/week @ 2022-05-26 481/week @ 2022-06-02 362/week @ 2022-06-09 202/week @ 2022-06-16 250/week @ 2022-06-23 585/week @ 2022-06-30

1,480 downloads per month

Unlicense

4.5MB
82K SLoC

C 48K SLoC // 0.2% comments Assembly 24K SLoC // 0.2% comments GNU Style Assembly 7K SLoC // 0.1% comments Rust 2.5K SLoC // 0.0% comments

turbojpeg

Rust bindings for TurboJPEG, which provides simple and fast operations for JPEG images:

  • Compression (encoding)
  • Decompression (decoding)
  • Lossless transformations

Usage with image-rs

To quickly encode and decode images from the image crate, add this to the [dependencies] section in your Cargo.toml:

turbojpeg = {version = "0.4", features = ["image"]}

and then use the functions turbojpeg::decompress_image and turbojpeg::compress_image.

For more advanced usage without the image crate, please see the documentation.

Requirements

The low-level binding to libturbojpeg is provided by the crate turbojpeg-sys, which needs to link to the C library. Typically, you will need a C compiler and NASM to build the library from source, but see its README for details.

Contributing

All contributions are welcome! Please contact me (@honzasp) or open a pull request. This crate is rather minimal, the main areas of improvement are:

  • Improving the build process of turbojpeg-sys crate, so that it works seamlessly on a wide range of systems.
  • Testing.
  • Extending the safe Rust API provided by turbojpeg crate.

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Dependencies