ImageOptim / mozjpeg-rust

Safe Rust wrapper for the MozJPEG library
https://lib.rs/mozjpeg
Other
74 stars 19 forks source link

Added pixel density getter and setter for compression and decompression #41

Closed nikarh closed 5 months ago

nikarh commented 5 months ago

Hi, this is a follow-up to https://github.com/kornelski/mozjpeg-sys/pull/37.

This provides a better API than potentially exposing corresponding cinfo fields. The structs are similar to the ones in the image crate (https://docs.rs/image/latest/image/codecs/jpeg/struct.PixelDensity.html).

The getter is a bit questionable in the way it handles invalid density units, but I wasn't sure of the best approach here.