Struct stitchy_core::ImageFiles
source · pub struct ImageFiles<P: FileProperties> { /* private fields */ }
Expand description
Types used for loading files and passing them into the image stitching process A set of image files, storing some file properties internally.
The files can be sorted and truncated according to the options supplied, and then converted
into a vector of DynamicImage
structs which will contain the actual image data for all
files.
Construct using the ImageFilesBuilder
struct.
See crate-level documentation for examples.
Implementations§
source§impl<P: FileProperties> ImageFiles<P>
impl<P: FileProperties> ImageFiles<P>
sourcepub fn builder<L: FileLocation<P>>() -> ImageFilesBuilder<P, L>
pub fn builder<L: FileLocation<P>>() -> ImageFilesBuilder<P, L>
Create a new ImageFilesBuilder for selecting files
sourcepub fn allowed_extensions() -> [&'static str; 5]
pub fn allowed_extensions() -> [&'static str; 5]
Return an array of the accepted file extensions.
These match image formats that can be processed by this crate. Adding individual files with other extensions will fail, and files with other extensions will be ignored if adding whole directories.
sourcepub fn get_main_extension(format: ImageFormat) -> Option<&'static str>
pub fn get_main_extension(format: ImageFormat) -> Option<&'static str>
Get the “main” extension used by a format.
This is subjective in nature. One thing that is known is that these are all contained in the set of usable formats in ImageFiles::allowed_extensions.
sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
Get the number of files in the current working set
sourcepub fn total_size(&self) -> u64
pub fn total_size(&self) -> u64
Get the total size, in bytes, of all files in the set
sourcepub fn sort_and_truncate_by(
self,
number_of_files: usize,
order_by: OrderBy,
take_from: TakeFrom,
reverse: bool
) -> Result<Self, String>
pub fn sort_and_truncate_by( self, number_of_files: usize, order_by: OrderBy, take_from: TakeFrom, reverse: bool ) -> Result<Self, String>
Sorts the files according to the options supplied, and truncates the set to the number of files requested by the user
sourcepub fn into_image_contents(
self,
print_info: bool
) -> Result<Vec<DynamicImage>, String>
pub fn into_image_contents( self, print_info: bool ) -> Result<Vec<DynamicImage>, String>
Load the image data from the files in the set, and return a vector of DynamicImage
.
The result can then be stitched together.
sourcepub fn common_format_in_sources(&self) -> Option<ImageFormat>
pub fn common_format_in_sources(&self) -> Option<ImageFormat>
Suggest an output format to use for saving the stitch result after loading and stitching the image files in this set.
If all files use the same format, this will be the suggestion. If the formats vary, or if there are no files in the set, then None will be returned.