
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
An image processing engine integrating multiple conversion libraries.
Impro allows specifying the operations to apply to images and will select the correct conversion library to perform the job itself.
Support for the following libraries is included:
Impro is desgined so that users can express what they want to do to an image of a given type rather than how to do it. Given a series of tranformations, the library will select one or more libraries to use to turn the input image into the desired output and processing is done while fully streaming data.
Image processing has typically involved command line tools which are often supplied a set of command line arguments that act as a series of instructions for the properties of the image being output and anuy transformations to apply. Each of these options is modelled as an "operation".
An operation is a named constraint (property or transformation) that an output image must conform to after it is applied.
An engine is a representation a particular image library that supports a certain set of operations on images of certain types.
A pipeline is a programmed series operations that will be executed by one or more engines to turn an image from the input to the desired output.
The impro
library can be installed simply from npm:
npm install impro
The standard configuration of impro is an instance that is configured with support for all supported engines - but the presence of the image libraries is detected which means they must be installed alongside. Each library has a node module of the same name (with the exception of gm as noted above):
npm install sharp
npm install gifsicle
some of the libraries may have requirements on native packages that must be installed via an operating system package manager
By default an import of impro returns an object with all registered engines that is ready to start handling conversion operations. To do this, we create a pipeline which we instruct about what it will do to an image.
The prepared pipeline is a Duplex stream that is ready to have the input image data piped to it and will stream the output image data out of itself:
const impro = require('impro');
const pipeline = impro.createPipeline({ type: 'png' }).jpeg();
For example, the pipeline above expect to recieve a PNG input image and will convert it to a JPEG using the chaining API.
The pipeline exposes methods for each operation that can be supported on a
method. Above, the .jpeg()
is a conversion operation to the JPEG type.
Let's look at another example:
impro
.createPipeline({ type: 'png' })
.grayscale()
.resize(100, 100)
.jpeg()
.progressive();
This will accept a PNG, convert it to a grayscale image, resize it and finally output it as a JPEG that is interlaced. The chaining API is intended as the standard end-user interface that exposes the full power of the library in a simple and transparent fashion.
For cases where impro is used as a library another API is exposed which is also used internally and underlies chaining methods: an operations list.
Each named operation is itself a small object containing a name and array of the arguments (zero or more) that are provided to it. These operations are placed in an array and can be passed directly when creating a pipeline:
const pipeline = impro.createPipeline({ type: 'png }, [
{ name: 'grayscale', args: [] },
{ name: 'resize', args: [100, 100] },
{ name: 'jpeg', args: [] },
{ name: 'progressive', args: [] }
]);
The pipeline above is equivalent to the chaining API example.
Impro is licensed under a standard 3-clause BSD license.
FAQs
Image processing engine
The npm package impro receives a total of 6,950 weekly downloads. As such, impro popularity was classified as popular.
We found that impro demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.