Struct turbojpeg::Compressor [−][src]
pub struct Compressor { /* fields omitted */ }
Compresses raw pixel data into JPEG.
Implementations
impl Compressor
[src]
impl Compressor
[src]pub fn new() -> Result<Compressor>
[src]
Create a new compressor instance.
pub fn set_quality(&mut self, quality: i32)
[src]
Set the quality of the compressed JPEG images.
The quality ranges from 1 (worst) to 100 (best).
pub fn set_subsamp(&mut self, subsamp: Subsamp)
[src]
Set the level of chrominance subsampling of the compressed JPEG images.
Chrominance subsampling can reduce the compressed image size without noticeable loss of
quality (see Subsamp
for more).
pub fn compress_to_vec(&mut self, image: Image<&[u8]>) -> Result<Vec<u8>>
[src]
Compress the image
into a new Vec<u8>
.
This method is simpler than compress_to_slice
, but it
requires multiple allocations and copies the output data from internal buffer to a Vec
.
pub fn compress_to_slice(
&mut self,
image: Image<&[u8]>,
dest: &mut [u8]
) -> Result<usize>
[src]
&mut self,
image: Image<&[u8]>,
dest: &mut [u8]
) -> Result<usize>
Compress the image
into the buffer dest
.
Returns the size of the compressed image. If the compressed image does not fit into dest
,
this method returns an error. Use buf_len
to determine buffer size
that is guaranteed to be large enough to compress the image
.
pub fn buf_len(&self, width: usize, height: usize) -> Result<usize>
[src]
Compute the maximum size of a compressed image.
This depends on image width
and height
, and also on the current setting of chrominance
subsampling (see set_subsamp()
.
Trait Implementations
impl Drop for Compressor
[src]
impl Drop for Compressor
[src]impl Send for Compressor
[src]
impl Send for Compressor
[src]Auto Trait Implementations
impl RefUnwindSafe for Compressor
impl RefUnwindSafe for Compressor
impl !Sync for Compressor
impl !Sync for Compressor
impl Unpin for Compressor
impl Unpin for Compressor
impl UnwindSafe for Compressor
impl UnwindSafe for Compressor