pub struct JpegTileEncoder {}Expand description
JPEG tile encoder for decoding and re-encoding tiles.
This encoder takes raw JPEG data from slide tiles, decodes it to pixels, and re-encodes it at the requested quality level.
§Example
ⓘ
use wsi_streamer::tile::JpegTileEncoder;
use bytes::Bytes;
let encoder = JpegTileEncoder::new();
// Source JPEG data from slide
let source_jpeg: Bytes = /* ... */;
// Re-encode at quality 85
let output = encoder.encode(&source_jpeg, 85)?;Implementations§
Source§impl JpegTileEncoder
impl JpegTileEncoder
Sourcepub fn encode(&self, source: &[u8], quality: u8) -> Result<Bytes, TileError>
pub fn encode(&self, source: &[u8], quality: u8) -> Result<Bytes, TileError>
Decode source tile and re-encode at the specified quality.
This method auto-detects the source format (JPEG or JPEG 2000) and decodes accordingly. Output is always JPEG.
§Arguments
source- Raw tile data (JPEG or JPEG 2000)quality- Output JPEG quality (1-100)
§Returns
Encoded JPEG data at the requested quality.
§Errors
Returns an error if:
- The source data format is not recognized
- Decoding fails
- Encoding fails
Trait Implementations§
Source§impl Clone for JpegTileEncoder
impl Clone for JpegTileEncoder
Source§fn clone(&self) -> JpegTileEncoder
fn clone(&self) -> JpegTileEncoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JpegTileEncoder
impl Debug for JpegTileEncoder
Source§impl Default for JpegTileEncoder
impl Default for JpegTileEncoder
Source§fn default() -> JpegTileEncoder
fn default() -> JpegTileEncoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for JpegTileEncoder
impl RefUnwindSafe for JpegTileEncoder
impl Send for JpegTileEncoder
impl Sync for JpegTileEncoder
impl Unpin for JpegTileEncoder
impl UnwindSafe for JpegTileEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.