All getters have the same signature:
gm("image.png").size(function(err, value){
// note : value may be undefined
})
size
- returns the size (WxH) of the imageformat
- returns the image format (gif, jpeg, png, etc)depth
- returns the image color depthcolor
- returns the number of colorsres
- returns the image resolutionfilesize
- returns image filesizeidentify
- returns all image data availableBy default all imgs are anti-aliased by GrahpicsMagick. To disable it pass false.
gm("img.png").antialias(false)
Specifies the number of bits of color to preserve in the image. See the docs for more detail.
gm("img.png").bitdepth(bits)
Accepts a radius
and optional sigma
(standard deviation).
gm("img.png").blur(radius [, sigma])
Simulates a charcoal drawing. Accepts a factor
.
gm("img.png").charcoal(factor)
Removes pixels from the interior of an image.
gm("img.png").chop(width, height, x, y)
Sets the preferred number of colors for the image (color reduction).
gm("img.png").colors(int)
Colorize the image with optionally separate red, green, and blue values.
gm("img.png").colorize(red [, green [, blue]])
Specifies the type of colorspace. See the GraphicsMagick
docs for val
details.
gm("img.png").colorspace(val)
Annotates an image. See the docs for more info.
gm("img.png").comment(text|format)
Increases or reduces the image contrast. Accepts a multiplier.
gm("img.png").contrast([+-]multiplier)
Crops the image to the given width
and height
at the given x
and y
position.
gm("img.png").crop(width, height, x, y)
Displace the image colormap by amount. amount
is the number of positions each colormap entry is shifted.
gm("img.png").cycle(amount)
Reduces the speckles within the image.
gm("img.png").despeckle()
Applies Floyd/Steinberg error diffusion to the image. Pass false
to disable dithering.
Note: either .colors()
or .monochrome()
must be used for this to take effect.
gm("img.png").dither([bool])
Emphasizes edges in an image. Takes an optional radius
of the emphasis to apply.
gm("img.png").edge([radius])
Embosses the image. Takes an optional radius
.
gm("img.png").emboss([radius])
Enhances the image.
gm("img.png").enhance()
Performs histogram equalization to the image.
gm("img.png").equalize()
Creates a mirror image (vertically).
gm("img.png").flip()
Creates a mirror image (horizontally).
gm("img.png").flop()
Adjusts the level of gamma correction.
gm("img.png").gamma(r, g, b)
Implodes the image pixels around the center. Takes an optional factor
.
gm("img.png").implode([factor])
Assigns a label to an image.
gm("img.png").label(name)
Sets resource limits.
type
val
gm("img.png").limit(type, val)
Creates a pseudo 3D lowering effect of the images edges.
gm("img.png").lower(width, height)
Magnifies the image factor
times.
gm("img.png").magnify(factor)
Applies a median filter to the image. The optional param radius
adjusts the weight of the effect.
gm("img.png").median([radius])
Minifies the image factor
times.
gm("img.png").minify(factor)
Varies the brightness, saturation, and hue of the image.
gm("img.png").modulate(b [, s [, h]])
Transforms the image to black and white.
gm("img.png").monochrome()
Morphs two images together.
otherImg
outName
callback
callback
will be passed the standard args that .write()
receives.gm("img.png").morph(otherImg, outName, callback)
Replaces every pixel with its complementary color.
gm("img.png").negative()
Add or reduce noise in the image.
radius|type
radius
which adjusts the weight of the effect.gm("img.png").noise(radius|type)
Removes EXIF, ICM, etc profile data.
gm("img.png").noProfile()
Simulates an oil painting.
gm("img.png").paint(radius)
Adjusts the jpeg|miff|png|tiff compression level. val
ranges from 0 to 100 (best).
gm("img.png").quality(val)
Creates a pseudo 3D raising effect of the images edges.
gm("img.png").raise(width, height)
Specifies that all following methods only apply to the area specified by width, height, x, y
.
gm("img.png").region(width, height, x, y).sepia()
In this case, the sepia effect would only be applied within the area specified by width, height, x, y
.
Resamples the image to specified horizontal and vertical resolution.
gm("img.png").resample(horizontal, vertical)
Resize the image.
gm("img.png").resize(width, height)
Rolls an image vertically or horizontally.
gm("img.png").roll(horizontalInt, verticalInt)
Rotates the image by degrees
and fills the background with color
.
gm("img.png").rotate(color, degrees)
Scales the image.
gm("img.png").scale(width, height)
A convenience method to apply a sepia effect to the image.
gm("img.png").sepia()
Negates all pixels above threshold
percent.
gm("img.png").solarize(threshold)
Desplaces pixels by a random amount
.
gm("img.png").spread(amount)
Swirls pixels arount the center of the image. degrees
specifies the tightness of the swirl.
gm("img.png").swirl(degrees)
Creates a thumbnail based on minimum sizes.
width
height
outName
callback
.write(err, stdout, stderr, command)
receives.gm("img.png").thumb(width, height, outName, callback)