5 releases (stable)
1.1.2 | Jun 28, 2024 |
---|---|
1.1.0 | Dec 17, 2023 |
1.0.0 | Dec 16, 2023 |
0.0.1 | Dec 16, 2023 |
#224 in Images
31KB
386 lines
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.
What does it mean to "merge" images?
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.
Install
Run the following Cargo command in your project directory:
cargo add image-merger
Benchmarks
100x100px Fixed-Size Images
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.
Dependencies
~2.5MB
~52K SLoC