Crate stitchy_core

Crate stitchy_core 

Source
Expand description

Joining images together into a single image.

Provides two processes, each configured using the builder pattern:

  • Selecting image files
  • Copying the (typically resized) contents of those files into a single output image

The first process is performed by the ImageFiles struct and its associated builder pattern. Files are added either individually or from a directory.

The second process is performed by the Stitch struct and its associated builder pattern. The configuration sets the output image size and layout of the output image. The output image is returned as an in-memory struct of type [DynamicImage], re-exported from the image crate (see the image crate on crates.io).

§Examples

// Select image files in current directory, take first 3 by alphabetic order on file name
use stitchy_core::{ImageFiles, OrderBy, TakeFrom};
let image_files = ImageFiles::builder()
    .add_current_directory(vec!["..", "..", "images", "demo"]).unwrap()
    .build().unwrap()
    .sort_and_truncate_by(3, OrderBy::Alphabetic, TakeFrom::Start, false).unwrap();

// Stitch images in a horizontal line, restricting the width to 1000 pixels
use stitchy_core::{Stitch, AlignmentMode};
let stitch = Stitch::builder()
    .image_files(image_files).unwrap()
    .width_limit(1000)
    .alignment(AlignmentMode::Horizontal)
    .stitch();

assert!(stitch.is_ok());

Modules§

image
Re-exports from the image crate
util
File utilities, used by the CLI crate

Structs§

FilePath
Types used for loading files and passing them into the image stitching process Wrapper for a file’s location by its absolute filesystem path
FilePathWithMetadata
Types used for loading files and passing them into the image stitching process Wrapper for file metadata. Loading these properties for a file does not require actually reading, let alone parsing, the file’s contents.
ImageFiles
Types used for loading files and passing them into the image stitching process A set of image files, storing some file properties internally.
ImageFilesBuilder
Types used for loading files and passing them into the image stitching process Builder for the ImageFiles struct.
OwnedRawFdLocation
Wrapper for a file’s location by a raw file descriptor. This owns the file descriptor now, and the file will be closed when this instance is dropped.
OwnedRawFdProperties
Wrapper for file metadata. Loading these properties for a file does not require actually reading, let alone parsing, the file’s contents. Like the OwnedRawFdLocation, this owns the file descriptor now, and the file will be closed when this instance is dropped.
RawBufferLocation
Types used for loading files and passing them into the image stitching process Wrapper for a file’s raw data, and everything that cannot be obtained from that data.
RawBufferProperties
Types used for loading files and passing them into the image stitching process Wrapper for a byte buffer, paired with data that cannot be extracted easily.
Stitch
Type used for running the image stitching process The full set of inputs for a stitch operation, including the source images and the layout that the output will take. Use the StitchBuilder for the entire stitching process.
StitchBuilder
Type used for running the image stitching process Builder for a Stitch.

Enums§

AlignmentMode
Type used for running the image stitching process Layout configuration for the stitched result.
OrderBy
Enums used for configuring the image stitching process Configure the order in which files are taken when selecting files from a set. Specify which end of the list to take files from when stitching using TakeFrom.
TakeFrom
Enums used for configuring the image stitching process Configure which end of the set of files to take from. The first file used will be the one at the specified end, and then the next file in from the end, and so on. The meaning of TakeFrom::Start or TakeFrom::End depends on the ordering specified with OrderBy.

Traits§

FileLocation
Types used for loading files and passing them into the image stitching process Representation of a file’s location.
FileProperties
Types used for loading files and passing them into the image stitching process Functions to get useful properties of files. Implementers of this trait are representations of files. The files are not necessarily required to be open, or to have been opened or read.

Functions§

extension_formats
Types used for loading files and passing them into the image stitching process Mappings of known file extensions to their image format