partial.js logo
Latest version
v1.3.1 (RC2)

FrameworkImage


This class contains functions for manipulation of images. For using of FrameworkImage you must have on server installed ImageMagick or GraphicsMagick plugin.


Example:


var Image = require('partial.js/image');
var image = Image.load('filename', [imageMagick]);

// OR 

var image = Image.load(fs.createReadStream('/users/petersirka/desktop/header.jpg'));

image.resizeCenter(200, 200);
image.grayscale();
image.save('filename');

Methods


image.align(type)image.background(color)image.bitdepth(value)image.blur(radius)image.colors(value)image.command(arg, [priority])image.crop(width, height, x, y)image.flip()image.flop()image.grayscale()image.identify(callback)image.measure(callback)image.minify()image.normalize()image.output(type)image.pipe(stream, [type], [options])image.quality(percentage)image.resize(width, height, options)image.resizeCenter(width, height)image.rotate(deg)image.save(filename, [callback])image.scale(width, height, options)image.sepia()image.stream([type])require('partial.js/image').load(filename, [imagemagick])
image.align(type);
return FrameworkImage;

Set align of image.

image.background(color);
return FrameworkImage;

Set background of image.

image.bitdepth(value);
return FrameworkImage;

Set bit depth of image.

image.blur(radius);
return FrameworkImage;

Set blur of image.

image.colors(value);
return FrameworkImage;

Set colors of image.

image.command(arg, [priority]);
internal
return FrameworkImage;

Add a custom command.

image.crop(width, height, x, y);
return FrameworkImage;

Crop image.

image.flip();
return FrameworkImage;

Flip image.

image.flop();
return FrameworkImage;

Flop image (opposite flip).

image.grayscale();
return FrameworkImage;

Grayscale of image.

image.identify(callback);
return FrameworkImage;

Get image informations (type, width, height).

image.measure(callback);
return FrameworkImage;

Get image size.

image.minify();
return FrameworkImage;

Minify image.

image.normalize();
return FrameworkImage;

Set normalize of image.

image.output(type);
return FrameworkImage;

Set default output type.

image.pipe(stream, [type], [options]);
return FrameworkImage;

Pipe stream to stream.

image.quality(percentage);
return FrameworkImage;

Set image quality.

image.resize(width, height, options);
return FrameworkImage;

Resize image.

image.resizeCenter(width, height);
return FrameworkImage;

Resize image with align: center center.

image.rotate(deg);
return FrameworkImage;

Rotate image.

image.save(filename, [callback]);
important
return FrameworkImage;

Save image modification into the file. This function run all defined/called image commands.

image.scale(width, height, options);
return FrameworkImage;

Scale image.

image.sepia();
return FrameworkImage;

Sepia of image.

image.stream([type]);
return FrameworkImage;

Create stream from an Image.

require('partial.js/image').load(filename, [imagemagick]);
important
return FrameworkImage;

Create an Image instance.