ImageOptim / mozjpeg-rust

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

Equivalent of jpegtran -optimize #24

Closed theduke closed 1 year ago

theduke commented 2 years ago

I want to optionally embed mozjpeg as an alternative to calling out to jpegtran.

It would be great to have an example for doing the equivalent of jpegtran -optimize with code.

I assume I have to first decompress, then compress with Compress::set_optimize_scans(true), but it would be great to get some confirmation from someone familiar with the library.

kornelski commented 2 years ago

There's no equivalent to jpegtran.

jpegtran uses a different private API. See source of jpegtran.c and copy what it does.

kornelski commented 1 year ago

I've added jpegtran feature to mozjpeg-sys to build those extra APIs. I don't have safe wrapper for them (yet?)

https://lib.rs/crates/mozjpeg-sys/features#feature-jpegtran