{"id":13395045,"url":"https://github.com/aheckmann/gm","last_synced_at":"2026-01-21T08:13:51.751Z","repository":{"id":940448,"uuid":"715524","full_name":"aheckmann/gm","owner":"aheckmann","description":"GraphicsMagick for node","archived":false,"fork":false,"pushed_at":"2023-12-19T04:24:08.000Z","size":5519,"stargazers_count":6968,"open_issues_count":370,"forks_count":617,"subscribers_count":113,"default_branch":"master","last_synced_at":"2025-02-18T09:12:15.235Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://aheckmann.github.com/gm/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aheckmann.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2010-06-11T12:11:37.000Z","updated_at":"2025-02-13T02:26:05.000Z","dependencies_parsed_at":"2024-01-02T20:55:28.408Z","dependency_job_id":null,"html_url":"https://github.com/aheckmann/gm","commit_stats":{"total_commits":575,"total_committers":86,"mean_commits":6.686046511627907,"dds":"0.43304347826086953","last_synced_commit":"6ad6cce4e807ce5a9a476a783d264c9d3bb5b571"},"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aheckmann%2Fgm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aheckmann%2Fgm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aheckmann%2Fgm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aheckmann%2Fgm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aheckmann","download_url":"https://codeload.github.com/aheckmann/gm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240645303,"owners_count":19834397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:01:40.284Z","updated_at":"2026-01-21T08:13:51.724Z","avatar_url":"https://github.com/aheckmann.png","language":"JavaScript","readme":"# 2025-02-24 This project is not maintained\n\nInstead of using this project, execute the `gm` or `magick` binaries using\n[`cross-spawn`](https://www.npmjs.com/package/cross-spawn) directly.\n\nNearly [15 years ago](https://github.com/aheckmann/gm/commit/defc7360d70d87f7a13da4f6e2ef0104594776b9) I started this project as part of my start up which I sold later that year (2010). Having not used this project in over a decade and with no contributors for years, it's time to officially sunset `gm`.\n\nNo further Issues will be addressed. No Pull Requests will be merged. No new commits or npm releases will be made.\n\n---\n\n😍 _Massive **thank you** to [everyone](https://github.com/aheckmann/gm/graphs/contributors) who contributed to this project over the years._ 😍\n\n---\n\n## I want to continue using gm. What do I do?\n\nAll past `gm` releases published to the npm registry will continue to be available for install. However, you should **prioritize moving off of this project to an alternative** because the risk of unpatched vulnerabilities in this project will continue to _increase_ over time. No new commits will land and no new releases will be published.\n\nThe most obvious alternative to `gm` I see is installing [cross-spawn](https://www.npmjs.com/package/cross-spawn) and executing the GraphicsMagick or ImageMagick binaries directly, after all, that's pretty much all this project did. There may be other `gm` alternatives on npm but I don't what they are offhand so you'll need to search for something suitable yourself.\n\n---\n\n\n# gm [![Build Status](https://travis-ci.org/aheckmann/gm.png?branch=master)](https://travis-ci.org/aheckmann/gm)  [![NPM Version](https://img.shields.io/npm/v/gm.svg?style=flat)](https://www.npmjs.org/package/gm)\n\nGraphicsMagick and ImageMagick for node\n\n## Bug Reports\n\nWhen reporting bugs please include the version of graphicsmagick/imagemagick you're using (gm -version/convert -version) as well as the version of this module and copies of any images you're having problems with.\n\n## Getting started\nFirst download and install [GraphicsMagick](http://www.graphicsmagick.org/) or [ImageMagick](http://www.imagemagick.org/). In Mac OS X, you can simply use [Homebrew](http://mxcl.github.io/homebrew/) and do:\n\n    brew install imagemagick\n    brew install graphicsmagick\n\nthen either use npm:\n\n    npm install gm\n\nor clone the repo:\n\n    git clone git://github.com/aheckmann/gm.git\n\n\n## Use ImageMagick instead of gm\n\nSubclass `gm` to enable [ImageMagick 7+](https://imagemagick.org/script/porting.php)\n\n```js\nconst fs = require('fs')\nconst gm = require('gm').subClass({ imageMagick: '7+' });\n```\n\nOr, to enable ImageMagick legacy mode (for ImageMagick version \u003c 7)\n\n```js\nconst fs = require('fs')\nconst gm = require('gm').subClass({ imageMagick: true });\n```\n\n## Specify the executable path\n\nOptionally specify the path to the executable.\n\n```js\nconst fs = require('fs')\nconst gm = require('gm').subClass({\n  appPath: String.raw`C:\\Program Files\\ImageMagick-7.1.0-Q16-HDRI\\magick.exe`\n});\n```\n\n## Basic Usage\n\n```js\nvar fs = require('fs')\n  , gm = require('gm');\n\n// resize and remove EXIF profile data\ngm('/path/to/my/img.jpg')\n.resize(240, 240)\n.noProfile()\n.write('/path/to/resize.png', function (err) {\n  if (!err) console.log('done');\n});\n\n// some files would not be resized appropriately\n// http://stackoverflow.com/questions/5870466/imagemagick-incorrect-dimensions\n// you have two options:\n// use the '!' flag to ignore aspect ratio\ngm('/path/to/my/img.jpg')\n.resize(240, 240, '!')\n.write('/path/to/resize.png', function (err) {\n  if (!err) console.log('done');\n});\n\n// use the .resizeExact with only width and/or height arguments\ngm('/path/to/my/img.jpg')\n.resizeExact(240, 240)\n.write('/path/to/resize.png', function (err) {\n  if (!err) console.log('done');\n});\n\n// obtain the size of an image\ngm('/path/to/my/img.jpg')\n.size(function (err, size) {\n  if (!err)\n    console.log(size.width \u003e size.height ? 'wider' : 'taller than you');\n});\n\n// output all available image properties\ngm('/path/to/img.png')\n.identify(function (err, data) {\n  if (!err) console.log(data)\n});\n\n// pull out the first frame of an animated gif and save as png\ngm('/path/to/animated.gif[0]')\n.write('/path/to/firstframe.png', function (err) {\n  if (err) console.log('aaw, shucks');\n});\n\n// auto-orient an image\ngm('/path/to/img.jpg')\n.autoOrient()\n.write('/path/to/oriented.jpg', function (err) {\n  if (err) ...\n})\n\n// crazytown\ngm('/path/to/my/img.jpg')\n.flip()\n.magnify()\n.rotate('green', 45)\n.blur(7, 3)\n.crop(300, 300, 150, 130)\n.edge(3)\n.write('/path/to/crazy.jpg', function (err) {\n  if (!err) console.log('crazytown has arrived');\n})\n\n// annotate an image\ngm('/path/to/my/img.jpg')\n.stroke(\"#ffffff\")\n.drawCircle(10, 10, 20, 10)\n.font(\"Helvetica.ttf\", 12)\n.drawText(30, 20, \"GMagick!\")\n.write(\"/path/to/drawing.png\", function (err) {\n  if (!err) console.log('done');\n});\n\n// creating an image\ngm(200, 400, \"#ddff99f3\")\n.drawText(10, 50, \"from scratch\")\n.write(\"/path/to/brandNewImg.jpg\", function (err) {\n  // ...\n});\n```\n\n## Streams\n\n```js\n// passing a stream\nvar readStream = fs.createReadStream('/path/to/my/img.jpg');\ngm(readStream, 'img.jpg')\n.write('/path/to/reformat.png', function (err) {\n  if (!err) console.log('done');\n});\n\n\n// passing a downloadable image by url\n\nvar request = require('request');\nvar url = \"www.abc.com/pic.jpg\"\n\ngm(request(url))\n.write('/path/to/reformat.png', function (err) {\n  if (!err) console.log('done');\n});\n\n\n// can also stream output to a ReadableStream\n// (can be piped to a local file or remote server)\ngm('/path/to/my/img.jpg')\n.resize('200', '200')\n.stream(function (err, stdout, stderr) {\n  var writeStream = fs.createWriteStream('/path/to/my/resized.jpg');\n  stdout.pipe(writeStream);\n});\n\n// without a callback, .stream() returns a stream\n// this is just a convenience wrapper for above.\nvar writeStream = fs.createWriteStream('/path/to/my/resized.jpg');\ngm('/path/to/my/img.jpg')\n.resize('200', '200')\n.stream()\n.pipe(writeStream);\n\n// pass a format or filename to stream() and\n// gm will provide image data in that format\ngm('/path/to/my/img.jpg')\n.stream('png', function (err, stdout, stderr) {\n  var writeStream = fs.createWriteStream('/path/to/my/reformatted.png');\n  stdout.pipe(writeStream);\n});\n\n// or without the callback\nvar writeStream = fs.createWriteStream('/path/to/my/reformatted.png');\ngm('/path/to/my/img.jpg')\n.stream('png')\n.pipe(writeStream);\n\n// combine the two for true streaming image processing\nvar readStream = fs.createReadStream('/path/to/my/img.jpg');\ngm(readStream)\n.resize('200', '200')\n.stream(function (err, stdout, stderr) {\n  var writeStream = fs.createWriteStream('/path/to/my/resized.jpg');\n  stdout.pipe(writeStream);\n});\n\n// GOTCHA:\n// when working with input streams and any 'identify'\n// operation (size, format, etc), you must pass \"{bufferStream: true}\" if\n// you also need to convert (write() or stream()) the image afterwards\n// NOTE: this buffers the readStream in memory!\nvar readStream = fs.createReadStream('/path/to/my/img.jpg');\ngm(readStream)\n.size({bufferStream: true}, function(err, size) {\n  this.resize(size.width / 2, size.height / 2)\n  this.write('/path/to/resized.jpg', function (err) {\n    if (!err) console.log('done');\n  });\n});\n\n```\n\n## Buffers\n\n```js\n// A buffer can be passed instead of a filepath as well\nvar buf = require('fs').readFileSync('/path/to/image.jpg');\n\ngm(buf, 'image.jpg')\n.noise('laplacian')\n.write('/path/to/out.jpg', function (err) {\n  if (err) return handle(err);\n  console.log('Created an image from a Buffer!');\n});\n\n/*\nA buffer can also be returned instead of a stream\nThe first argument to toBuffer is optional, it specifies the image format\n*/\ngm('img.jpg')\n.resize(100, 100)\n.toBuffer('PNG',function (err, buffer) {\n  if (err) return handle(err);\n  console.log('done!');\n})\n```\n\n## Custom Arguments\n\nIf `gm` does not supply you with a method you need or does not work as you'd like, you can simply use `gm().in()` or `gm().out()` to set your own arguments.\n\n- `gm().command()` - Custom command such as `identify` or `convert`\n- `gm().in()` - Custom input arguments\n- `gm().out()` - Custom output arguments\n\nThe command will be formatted in the following order:\n\n1. `command` - ie `convert`\n2. `in` - the input arguments\n3. `source` - stdin or an image file\n4. `out` - the output arguments\n5. `output` - stdout or the image file to write to\n\nFor example, suppose you want the following command:\n\n```bash\ngm \"convert\" \"label:Offline\" \"PNG:-\"\n```\n\nHowever, using `gm().label()` may not work as intended for you:\n\n```js\ngm()\n.label('Offline')\n.stream();\n```\n\nwould yield:\n\n```bash\ngm \"convert\" \"-label\" \"\\\"Offline\\\"\" \"PNG:-\"\n```\n\nInstead, you can use `gm().out()`:\n\n```js\ngm()\n.out('label:Offline')\n.stream();\n```\n\nwhich correctly yields:\n\n```bash\ngm \"convert\" \"label:Offline\" \"PNG:-\"\n```\n\n### Custom Identify Format String\n\nWhen identifying an image, you may want to use a custom formatting string instead of using `-verbose`, which is quite slow.\nYou can use your own [formatting string](http://www.imagemagick.org/script/escape.php) when using `gm().identify(format, callback)`.\nFor example,\n\n```js\ngm('img.png').format(function (err, format) {\n\n})\n\n// is equivalent to\n\ngm('img.png').identify('%m', function (err, format) {\n\n})\n```\n\nsince `%m` is the format option for getting the image file format.\n\n## Platform differences\n\nPlease document and refer to any [platform or ImageMagick/GraphicsMagick issues/differences here](https://github.com/aheckmann/gm/wiki/GraphicsMagick-and-ImageMagick-versions).\n\n## Examples:\n\n  Check out the [examples](http://github.com/aheckmann/gm/tree/master/examples/) directory to play around.\n  Also take a look at the [extending gm](http://wiki.github.com/aheckmann/gm/extending-gm)\n  page to see how to customize gm to your own needs.\n\n## Constructor:\n\n  There are a few ways you can use the `gm` image constructor.\n\n  - 1) `gm(path)` When you pass a string as the first argument it is interpreted as the path to an image you intend to manipulate.\n  - 2) `gm(stream || buffer, [filename])` You may also pass a ReadableStream or Buffer as the first argument, with an optional file name for format inference.\n  - 3) `gm(width, height, [color])` When you pass two integer arguments, gm will create a new image on the fly with the provided dimensions and an optional background color. And you can still chain just like you do with pre-existing images too. See [here](http://github.com/aheckmann/gm/blob/master/examples/new.js) for an example.\n\nThe links below refer to an older version of gm but everything should still work, if anyone feels like updating them please make a PR\n\n## Methods\n\n  - getters\n    - [size](http://aheckmann.github.io/gm/docs.html#getters) - returns the size (WxH) of the image\n    - [orientation](http://aheckmann.github.io/gm/docs.html#getters) - returns the EXIF orientation of the image\n    - [format](http://aheckmann.github.io/gm/docs.html#getters) - returns the image format (gif, jpeg, png, etc)\n    - [depth](http://aheckmann.github.io/gm/docs.html#getters) - returns the image color depth\n    - [color](http://aheckmann.github.io/gm/docs.html#getters) - returns the number of colors\n    - [res](http://aheckmann.github.io/gm/docs.html#getters)   - returns the image resolution\n    - [filesize](http://aheckmann.github.io/gm/docs.html#getters) - returns image filesize\n    - [identify](http://aheckmann.github.io/gm/docs.html#getters) - returns all image data available. Takes an optional format string.\n\n  - manipulation\n    - [adjoin](http://aheckmann.github.io/gm/docs.html#adjoin)\n    - [affine](http://aheckmann.github.io/gm/docs.html#affine)\n    - [antialias](http://aheckmann.github.io/gm/docs.html#antialias)\n    - [append](http://aheckmann.github.io/gm/docs.html#append)\n    - [authenticate](http://aheckmann.github.io/gm/docs.html#authenticate)\n    - [autoOrient](http://aheckmann.github.io/gm/docs.html#autoOrient)\n    - [average](http://aheckmann.github.io/gm/docs.html#average)\n    - [backdrop](http://aheckmann.github.io/gm/docs.html#backdrop)\n    - [bitdepth](http://aheckmann.github.io/gm/docs.html#bitdepth)\n    - [blackThreshold](http://aheckmann.github.io/gm/docs.html#blackThreshold)\n    - [bluePrimary](http://aheckmann.github.io/gm/docs.html#bluePrimary)\n    - [blur](http://aheckmann.github.io/gm/docs.html#blur)\n    - [border](http://aheckmann.github.io/gm/docs.html#border)\n    - [borderColor](http://aheckmann.github.io/gm/docs.html#borderColor)\n    - [box](http://aheckmann.github.io/gm/docs.html#box)\n    - [channel](http://aheckmann.github.io/gm/docs.html#channel)\n    - [charcoal](http://aheckmann.github.io/gm/docs.html#charcoal)\n    - [chop](http://aheckmann.github.io/gm/docs.html#chop)\n    - [clip](http://aheckmann.github.io/gm/docs.html#clip)\n    - [coalesce](http://aheckmann.github.io/gm/docs.html#coalesce)\n    - [colors](http://aheckmann.github.io/gm/docs.html#colors)\n    - [colorize](http://aheckmann.github.io/gm/docs.html#colorize)\n    - [colorMap](http://aheckmann.github.io/gm/docs.html#colorMap)\n    - [colorspace](http://aheckmann.github.io/gm/docs.html#colorspace)\n    - [comment](http://aheckmann.github.io/gm/docs.html#comment)\n    - [compose](http://aheckmann.github.io/gm/docs.html#compose)\n    - [compress](http://aheckmann.github.io/gm/docs.html#compress)\n    - [contrast](http://aheckmann.github.io/gm/docs.html#contrast)\n    - [convolve](http://aheckmann.github.io/gm/docs.html#convolve)\n    - [createDirectories](http://aheckmann.github.io/gm/docs.html#createDirectories)\n    - [crop](http://aheckmann.github.io/gm/docs.html#crop)\n    - [cycle](http://aheckmann.github.io/gm/docs.html#cycle)\n    - [deconstruct](http://aheckmann.github.io/gm/docs.html#deconstruct)\n    - [delay](http://aheckmann.github.io/gm/docs.html#delay)\n    - [define](http://aheckmann.github.io/gm/docs.html#define)\n    - [density](http://aheckmann.github.io/gm/docs.html#density)\n    - [despeckle](http://aheckmann.github.io/gm/docs.html#despeckle)\n    - [dither](http://aheckmann.github.io/gm/docs.html#dither)\n    - [displace](http://aheckmann.github.io/gm/docs.html#dither)\n    - [display](http://aheckmann.github.io/gm/docs.html#display)\n    - [dispose](http://aheckmann.github.io/gm/docs.html#dispose)\n    - [dissolve](http://aheckmann.github.io/gm/docs.html#dissolve)\n    - [edge](http://aheckmann.github.io/gm/docs.html#edge)\n    - [emboss](http://aheckmann.github.io/gm/docs.html#emboss)\n    - [encoding](http://aheckmann.github.io/gm/docs.html#encoding)\n    - [enhance](http://aheckmann.github.io/gm/docs.html#enhance)\n    - [endian](http://aheckmann.github.io/gm/docs.html#endian)\n    - [equalize](http://aheckmann.github.io/gm/docs.html#equalize)\n    - [extent](http://aheckmann.github.io/gm/docs.html#extent)\n    - [file](http://aheckmann.github.io/gm/docs.html#file)\n    - [filter](http://aheckmann.github.io/gm/docs.html#filter)\n    - [flatten](http://aheckmann.github.io/gm/docs.html#flatten)\n    - [flip](http://aheckmann.github.io/gm/docs.html#flip)\n    - [flop](http://aheckmann.github.io/gm/docs.html#flop)\n    - [foreground](http://aheckmann.github.io/gm/docs.html#foreground)\n    - [frame](http://aheckmann.github.io/gm/docs.html#frame)\n    - [fuzz](http://aheckmann.github.io/gm/docs.html#fuzz)\n    - [gamma](http://aheckmann.github.io/gm/docs.html#gamma)\n    - [gaussian](http://aheckmann.github.io/gm/docs.html#gaussian)\n    - [geometry](http://aheckmann.github.io/gm/docs.html#geometry)\n    - [gravity](http://aheckmann.github.io/gm/docs.html#gravity)\n    - [greenPrimary](http://aheckmann.github.io/gm/docs.html#greenPrimary)\n    - [highlightColor](http://aheckmann.github.io/gm/docs.html#highlightColor)\n    - [highlightStyle](http://aheckmann.github.io/gm/docs.html#highlightStyle)\n    - [iconGeometry](http://aheckmann.github.io/gm/docs.html#iconGeometry)\n    - [implode](http://aheckmann.github.io/gm/docs.html#implode)\n    - [intent](http://aheckmann.github.io/gm/docs.html#intent)\n    - [interlace](http://aheckmann.github.io/gm/docs.html#interlace)\n    - [label](http://aheckmann.github.io/gm/docs.html#label)\n    - [lat](http://aheckmann.github.io/gm/docs.html#lat)\n    - [level](http://aheckmann.github.io/gm/docs.html#level)\n    - [list](http://aheckmann.github.io/gm/docs.html#list)\n    - [limit](http://aheckmann.github.io/gm/docs.html#limit)\n    - [log](http://aheckmann.github.io/gm/docs.html#log)\n    - [loop](http://aheckmann.github.io/gm/docs.html#loop)\n    - [lower](http://aheckmann.github.io/gm/docs.html#lower)\n    - [magnify](http://aheckmann.github.io/gm/docs.html#magnify)\n    - [map](http://aheckmann.github.io/gm/docs.html#map)\n    - [matte](http://aheckmann.github.io/gm/docs.html#matte)\n    - [matteColor](http://aheckmann.github.io/gm/docs.html#matteColor)\n    - [mask](http://aheckmann.github.io/gm/docs.html#mask)\n    - [maximumError](http://aheckmann.github.io/gm/docs.html#maximumError)\n    - [median](http://aheckmann.github.io/gm/docs.html#median)\n    - [minify](http://aheckmann.github.io/gm/docs.html#minify)\n    - [mode](http://aheckmann.github.io/gm/docs.html#mode)\n    - [modulate](http://aheckmann.github.io/gm/docs.html#modulate)\n    - [monitor](http://aheckmann.github.io/gm/docs.html#monitor)\n    - [monochrome](http://aheckmann.github.io/gm/docs.html#monochrome)\n    - [morph](http://aheckmann.github.io/gm/docs.html#morph)\n    - [mosaic](http://aheckmann.github.io/gm/docs.html#mosaic)\n    - [motionBlur](http://aheckmann.github.io/gm/docs.html#motionBlur)\n    - [name](http://aheckmann.github.io/gm/docs.html#name)\n    - [negative](http://aheckmann.github.io/gm/docs.html#negative)\n    - [noise](http://aheckmann.github.io/gm/docs.html#noise)\n    - [noop](http://aheckmann.github.io/gm/docs.html#noop)\n    - [normalize](http://aheckmann.github.io/gm/docs.html#normalize)\n    - [noProfile](http://aheckmann.github.io/gm/docs.html#profile)\n    - [opaque](http://aheckmann.github.io/gm/docs.html#opaque)\n    - [operator](http://aheckmann.github.io/gm/docs.html#operator)\n    - [orderedDither](http://aheckmann.github.io/gm/docs.html#orderedDither)\n    - [outputDirectory](http://aheckmann.github.io/gm/docs.html#outputDirectory)\n    - [paint](http://aheckmann.github.io/gm/docs.html#paint)\n    - [page](http://aheckmann.github.io/gm/docs.html#page)\n    - [pause](http://aheckmann.github.io/gm/docs.html#pause)\n    - [pen](http://aheckmann.github.io/gm/docs.html#pen)\n    - [ping](http://aheckmann.github.io/gm/docs.html#ping)\n    - [pointSize](http://aheckmann.github.io/gm/docs.html#pointSize)\n    - [preview](http://aheckmann.github.io/gm/docs.html#preview)\n    - [process](http://aheckmann.github.io/gm/docs.html#process)\n    - [profile](http://aheckmann.github.io/gm/docs.html#profile)\n    - [progress](http://aheckmann.github.io/gm/docs.html#progress)\n    - [quality](http://aheckmann.github.io/gm/docs.html#quality)\n    - [raise](http://aheckmann.github.io/gm/docs.html#raise)\n    - [rawSize](http://aheckmann.github.io/gm/docs.html#rawSize)\n    - [randomThreshold](http://aheckmann.github.io/gm/docs.html#randomThreshold)\n    - [recolor](http://aheckmann.github.io/gm/docs.html#recolor)\n    - [redPrimary](http://aheckmann.github.io/gm/docs.html#redPrimary)\n    - [region](http://aheckmann.github.io/gm/docs.html#region)\n    - [remote](http://aheckmann.github.io/gm/docs.html#remote)\n    - [render](http://aheckmann.github.io/gm/docs.html#render)\n    - [repage](http://aheckmann.github.io/gm/docs.html#repage)\n    - [resample](http://aheckmann.github.io/gm/docs.html#resample)\n    - [resize](http://aheckmann.github.io/gm/docs.html#resize)\n    - [roll](http://aheckmann.github.io/gm/docs.html#roll)\n    - [rotate](http://aheckmann.github.io/gm/docs.html#rotate)\n    - [sample](http://aheckmann.github.io/gm/docs.html#sample)\n    - [samplingFactor](http://aheckmann.github.io/gm/docs.html#samplingFactor)\n    - [scale](http://aheckmann.github.io/gm/docs.html#scale)\n    - [scene](http://aheckmann.github.io/gm/docs.html#scene)\n    - [scenes](http://aheckmann.github.io/gm/docs.html#scenes)\n    - [screen](http://aheckmann.github.io/gm/docs.html#screen)\n    - [segment](http://aheckmann.github.io/gm/docs.html#segment)\n    - [sepia](http://aheckmann.github.io/gm/docs.html#sepia)\n    - [set](http://aheckmann.github.io/gm/docs.html#set)\n    - [setFormat](http://aheckmann.github.io/gm/docs.html#setformat)\n    - [shade](http://aheckmann.github.io/gm/docs.html#shade)\n    - [shadow](http://aheckmann.github.io/gm/docs.html#shadow)\n    - [sharedMemory](http://aheckmann.github.io/gm/docs.html#sharedMemory)\n    - [sharpen](http://aheckmann.github.io/gm/docs.html#sharpen)\n    - [shave](http://aheckmann.github.io/gm/docs.html#shave)\n    - [shear](http://aheckmann.github.io/gm/docs.html#shear)\n    - [silent](http://aheckmann.github.io/gm/docs.html#silent)\n    - [solarize](http://aheckmann.github.io/gm/docs.html#solarize)\n    - [snaps](http://aheckmann.github.io/gm/docs.html#snaps)\n    - [stegano](http://aheckmann.github.io/gm/docs.html#stegano)\n    - [stereo](http://aheckmann.github.io/gm/docs.html#stereo)\n    - [strip](http://aheckmann.github.io/gm/docs.html#strip) _imagemagick only_\n    - [spread](http://aheckmann.github.io/gm/docs.html#spread)\n    - [swirl](http://aheckmann.github.io/gm/docs.html#swirl)\n    - [textFont](http://aheckmann.github.io/gm/docs.html#textFont)\n    - [texture](http://aheckmann.github.io/gm/docs.html#texture)\n    - [threshold](http://aheckmann.github.io/gm/docs.html#threshold)\n    - [thumb](http://aheckmann.github.io/gm/docs.html#thumb)\n    - [tile](http://aheckmann.github.io/gm/docs.html#tile)\n    - [transform](http://aheckmann.github.io/gm/docs.html#transform)\n    - [transparent](http://aheckmann.github.io/gm/docs.html#transparent)\n    - [treeDepth](http://aheckmann.github.io/gm/docs.html#treeDepth)\n    - [trim](http://aheckmann.github.io/gm/docs.html#trim)\n    - [type](http://aheckmann.github.io/gm/docs.html#type)\n    - [update](http://aheckmann.github.io/gm/docs.html#update)\n    - [units](http://aheckmann.github.io/gm/docs.html#units)\n    - [unsharp](http://aheckmann.github.io/gm/docs.html#unsharp)\n    - [usePixmap](http://aheckmann.github.io/gm/docs.html#usePixmap)\n    - [view](http://aheckmann.github.io/gm/docs.html#view)\n    - [virtualPixel](http://aheckmann.github.io/gm/docs.html#virtualPixel)\n    - [visual](http://aheckmann.github.io/gm/docs.html#visual)\n    - [watermark](http://aheckmann.github.io/gm/docs.html#watermark)\n    - [wave](http://aheckmann.github.io/gm/docs.html#wave)\n    - [whitePoint](http://aheckmann.github.io/gm/docs.html#whitePoint)\n    - [whiteThreshold](http://aheckmann.github.io/gm/docs.html#whiteThreshold)\n    - [window](http://aheckmann.github.io/gm/docs.html#window)\n    - [windowGroup](http://aheckmann.github.io/gm/docs.html#windowGroup)\n\n  - drawing primitives\n    - [draw](http://aheckmann.github.io/gm/docs.html#draw)\n    - [drawArc](http://aheckmann.github.io/gm/docs.html#drawArc)\n    - [drawBezier](http://aheckmann.github.io/gm/docs.html#drawBezier)\n    - [drawCircle](http://aheckmann.github.io/gm/docs.html#drawCircle)\n    - [drawEllipse](http://aheckmann.github.io/gm/docs.html#drawEllipse)\n    - [drawLine](http://aheckmann.github.io/gm/docs.html#drawLine)\n    - [drawPoint](http://aheckmann.github.io/gm/docs.html#drawPoint)\n    - [drawPolygon](http://aheckmann.github.io/gm/docs.html#drawPolygon)\n    - [drawPolyline](http://aheckmann.github.io/gm/docs.html#drawPolyline)\n    - [drawRectangle](http://aheckmann.github.io/gm/docs.html#drawRectangle)\n    - [drawText](http://aheckmann.github.io/gm/docs.html#drawText)\n    - [fill](http://aheckmann.github.io/gm/docs.html#fill)\n    - [font](http://aheckmann.github.io/gm/docs.html#font)\n    - [fontSize](http://aheckmann.github.io/gm/docs.html#fontSize)\n    - [stroke](http://aheckmann.github.io/gm/docs.html#stroke)\n    - [strokeWidth](http://aheckmann.github.io/gm/docs.html#strokeWidth)\n    - [setDraw](http://aheckmann.github.io/gm/docs.html#setDraw)\n\n  - image output\n    - **write** - writes the processed image data to the specified filename\n    - **stream** - provides a `ReadableStream` with the processed image data\n    - **toBuffer** - returns the image as a `Buffer` instead of a stream\n\n## compare\n\nGraphicsmagicks `compare` command is exposed through `gm.compare()`. This allows us to determine if two images can be considered \"equal\".\n\nCurrently `gm.compare` only accepts file paths.\n\n    gm.compare(path1, path2 [, options], callback)\n\n```js\ngm.compare('/path/to/image1.jpg', '/path/to/another.png', function (err, isEqual, equality, raw, path1, path2) {\n  if (err) return handle(err);\n\n  // if the images were considered equal, `isEqual` will be true, otherwise, false.\n  console.log('The images were equal: %s', isEqual);\n\n  // to see the total equality returned by graphicsmagick we can inspect the `equality` argument.\n  console.log('Actual equality: %d', equality);\n\n  // inspect the raw output\n  console.log(raw);\n\n  // print file paths\n  console.log(path1, path2);\n})\n```\n\nYou may wish to pass a custom tolerance threshold to increase or decrease the default level of `0.4`.\n\n\n```js\ngm.compare('/path/to/image1.jpg', '/path/to/another.png', 1.2, function (err, isEqual) {\n  ...\n})\n```\n\nTo output a diff image, pass a configuration object to define the diff options and tolerance.\n\n\n```js\nvar options = {\n  file: '/path/to/diff.png',\n  highlightColor: 'yellow',\n  tolerance: 0.02\n}\ngm.compare('/path/to/image1.jpg', '/path/to/another.png', options, function (err, isEqual, equality, raw) {\n  ...\n})\n```\n\n## composite\n\nGraphicsMagick supports compositing one image on top of another. This is exposed through `gm.composite()`. Its first argument is an image path with the changes to the base image, and an optional mask image.\n\nCurrently, `gm.composite()` only accepts file paths.\n\n    gm.composite(other [, mask])\n\n```js\ngm('/path/to/image.jpg')\n.composite('/path/to/second_image.jpg')\n.geometry('+100+150')\n.write('/path/to/composite.png', function(err) {\n    if(!err) console.log(\"Written composite image.\");\n});\n```\n\n## montage\n\nGraphicsMagick supports montage for combining images side by side. This is exposed through `gm.montage()`. Its only argument is an image path with the changes to the base image.\n\nCurrently, `gm.montage()` only accepts file paths.\n\n    gm.montage(other)\n\n```js\ngm('/path/to/image.jpg')\n.montage('/path/to/second_image.jpg')\n.geometry('+100+150')\n.write('/path/to/montage.png', function(err) {\n    if(!err) console.log(\"Written montage image.\");\n});\n```\n\n## Contributors\n[https://github.com/aheckmann/gm/contributors](https://github.com/aheckmann/gm/contributors)\n\n## Inspiration\nhttp://github.com/quiiver/magickal-node\n\n## Plugins\n[https://github.com/aheckmann/gm/wiki](https://github.com/aheckmann/gm/wiki)\n\n## Tests\n`npm test`\n\nTo run a single test:\n\n```\nnpm test -- alpha.js\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2010 [Aaron Heckmann](aaron.heckmann+github@gmail.com)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":["JavaScript","Packages","Repository","GIT 仓库","包","Image Optimizers","目录","Uncategorized","Image"],"sub_categories":["Image","图像、图片处理","图像","图像处理","Uncategorized","Meetups"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faheckmann%2Fgm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faheckmann%2Fgm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faheckmann%2Fgm/lists"}