easyimage
- Version 3.1.1
- Published
- 51.3 kB
- 5 dependencies
- MIT license
Install
npm i easyimage
yarn add easyimage
pnpm add easyimage
Overview
A promise-based, user-friendly module for processing images in Node.js
Index
Functions
Classes
Interfaces
Functions
function convert
convert: (options: IConvertOptions) => Promise<IInfoResult>;
Converts an image from one format to another.
Parameter options
Returns
{Bluebird}
function crop
crop: (options: ICropOptions) => Promise<IInfoResult>;
Crops an image.
Parameter options
Returns
{Bluebird}
function execute
execute: (command: string, args: string[]) => Promise<IImageMagickCommandResult>;
Executes a command with arguments and returns the stdout and stderr.
Parameter command
the command to run (convert, identify, etc).
Parameter args
Returns
{Promise}
function getImageMagickVersion
getImageMagickVersion: (fresh?: boolean) => Promise<number>;
Returns the latest available version of ImageMagick
Parameter fresh
Do not used previously found version
Returns
{Promise}
function info
info: (filePath: string) => Promise<IInfoResult>;
Returns information about an image.
Parameter filePath
Path to the image file.
Returns
{Bluebird}
function rescrop
rescrop: (options: IResCropOptions) => Promise<IInfoResult>;
Resizes and crops an image.
Parameter options
Returns
{Bluebird}
function resize
resize: (options: IResizeOptions) => Promise<IInfoResult>;
Resizes an image.
Parameter options
Returns
{Bluebird}
function rotate
rotate: (options: IRotateOptions) => Promise<IInfoResult>;
Rotates an image by a specified number of degrees.
Parameter options
Returns
{Bluebird}
function thumbnail
thumbnail: (options: IThumbnailOptions) => Promise<IInfoResult>;
Creates a thumbnail of an image.
Parameter options
Returns
{Bluebird}
Classes
class BadDestinationError
class BadDestinationError extends Error {}
constructor
constructor();
class ImageMagickMissingError
class ImageMagickMissingError extends Error {}
constructor
constructor();
class MissingExtensionError
class MissingExtensionError extends Error {}
constructor
constructor(srcFile: string);
class MissingOptionsError
class MissingOptionsError extends Error {}
constructor
constructor(options: string[]);
class UnsupportedError
class UnsupportedError extends Error {}
constructor
constructor(err: string);
Interfaces
interface IConvertOptions
interface IConvertOptions extends IBaseOptions {}
interface ICropOptions
interface ICropOptions extends IBaseOptions {}
property cropheight
cropheight?: number;
Height of cropped image.
Deprecated
property cropHeight
cropHeight?: number;
Height of cropped image. cropWidth
property cropwidth
cropwidth?: number;
Width of cropped image.
Deprecated
property cropWidth
cropWidth: number;
Width of cropped image.
property gravity
gravity?: string;
Gravity for crop.
See Also
https://www.imagemagick.org/script/command-line-options.php#gravity
property x
x?: number;
Left distance of crop 0
property y
y?: number;
Top distance of crop 0
interface IImageMagickCommandResult
interface IImageMagickCommandResult {}
interface IInfoResult
interface IInfoResult {}
property density
density: IDensity;
The density of the image.
property depth
depth: number;
The number of bits in a color sample within a pixel.
property frames
frames: number;
Number of frames in image.
property height
height: number;
The height of the image.
property name
name: string;
The filename (excluding the path) of the image.
property orientation
orientation: string;
Orientation of the image.
property path
path: string;
The path to the image.
property size
size: number;
The filesize of the image in bytes.
property type
type: string;
Type of file.
property warnings
warnings?: string;
Any warnings that ImageMagick may have output.
property width
width: number;
The width of the image.
interface IResCropOptions
interface IResCropOptions extends ICropOptions, IResizeOptions {}
interface IResizeOptions
interface IResizeOptions extends IBaseOptions {}
property height
height?: number;
Height of resized image. cropWidth
property ignoreAspectRatio
ignoreAspectRatio?: boolean;
Ignore aspect ratio when resizing. false
property onlyDownscale
onlyDownscale?: boolean;
Only reduce the size of the image. Do not increase it. false
property width
width: number;
Width of resized image.
interface IRotateOptions
interface IRotateOptions extends IBaseOptions {}
property degree
degree: number;
Number of degrees to rotate the image.
interface IThumbnailOptions
interface IThumbnailOptions extends IBaseOptions {}
property gravity
gravity?: string;
Gravity for sizing.
See Also
https://www.imagemagick.org/script/command-line-options.php#gravity
property height
height: number;
Height of thumbnail.
property interpolate
interpolate?: string;
Interpolate the thumbnail.
property width
width: number;
Width of thumbnail.
property x
x?: number;
X offset for thumbnail.
property y
y?: number;
Y offset for thumbnail.
Package Files (14)
- types/commands/convert.d.ts
- types/commands/crop.d.ts
- types/commands/info.d.ts
- types/commands/rescrop.d.ts
- types/commands/resize.d.ts
- types/commands/rotate.d.ts
- types/commands/thumbnail.d.ts
- types/easyimage.d.ts
- types/errors/BadDestinationError.d.ts
- types/errors/ImageMagickMissingError.d.ts
- types/errors/MissingExtensionError.d.ts
- types/errors/MissingOptionsError.d.ts
- types/errors/UnsupportedError.d.ts
- types/execute.d.ts
Dependencies (5)
Dev Dependencies (19)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/easyimage
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/easyimage)
- HTML<a href="https://www.jsdocs.io/package/easyimage"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1063 ms. - Missing or incorrect documentation? Open an issue for this package.