Crates.io | image-merger |
lib.rs | image-merger |
version | 1.1.2 |
source | src |
created_at | 2023-12-16 23:26:51.236012 |
updated_at | 2024-06-28 04:24:09.202827 |
description | A tool to merge multiple images into one. |
homepage | |
repository | https://github.com/NextChai/image-merger |
max_upload_size | |
id | 1072039 |
size | 88,268 |
Welcome to Image Merger! A crate that provides blazing-fast functionality for merging many images. It is built on top of the image crate and works to boost performance by utilizing parallel processing and avoiding unnecessary costly operations.
A Merger paces many small images onto a larger canvas in a specific pattern/location. As of today, this library only has one type of Merger, a KnownSizeMerger
which focuses on performance as its top priority, but more will be added soon. An example of an output from a KnownSizeMerger
is below, this is the general output from the crate's tests.
Run the following Cargo command in your project directory:
cargo add image-merger
The disparity in merging 10,000 images of 100x100 pixels between the merger and a linear implementation is significant. As depicted below, the x-axis illustrates the number of images being merged, ranging from 1 to 10,000, while the y-axis indicates the duration in milliseconds it took to merge all the images. The linear implementation is shown in green and the image merger in orange.
Over the 10,000 image interval, the image merger yielded an average 3.646x speed increase over the linear implementation. Effectively speaking, the combined average time, in ms, to generate a merged image with $n100^2$ pixels is $A(n)= 0.0082n$, where $n$ is the number of merged images. Moreover, the average time to paste a single given pixel, in ms, is $A\left(n\right)=\frac{0.0082n}{100^{2}}$, where $n$ is the number of merged images.