Skip to main content

process_image

Function process_image 

Source
pub fn process_image(
    img: VipsImage,
    parsed_options: ParsedOptions,
    source_bytes: &Bytes,
    watermark: Option<&CachedWatermark>,
) -> Result<Bytes, ProcessingError>
Expand description

Processes an image by applying the given ParsedOptions.

This function takes a decoded VipsImage, the original source bytes, and a set of parsed options, applies transformations like resizing, cropping, blurring, and format conversion, then returns the processed image bytes.

§Arguments

  • img - The decoded source image to transform.
  • parsed_options - A ParsedOptions struct containing the desired transformations.
  • source_bytes - The original image bytes used for EXIF and metadata-driven operations.
  • watermark - Optional cached watermark to overlay on the source image.

§Returns

A Result containing the processed image bytes on success, or a typed processing error.