Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

NodeJs bindings for GD graphic library

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 coffee
Octocat-spinner-32 cpp
Octocat-spinner-32 js
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 README.md
Octocat-spinner-32 binding.gyp
Octocat-spinner-32 package.json
README.md

node-gd

GD graphic library (libgd) C++ bindings for Node.js.

This version is the community-maintained official NodeJS.org node-gd repo.

Installation on Debian/Ubuntu

sudo apt-get install libgd2-xpm-dev # libgd
npm install node-gd

Installation on Mac OS/X

please open an issue if you have the answer. i'm sure it works, i just don't have ready the exact commands.

see also: https://github.com/taggon/node-gd/issues/6

Installation on Windows 7

please open an issue if you have the answer. i'm sure it works, i just don't have ready the exact commands.

Usage

# Require library
gd = require 'node-gd'

# Create blank new image in memory
output_img = gd.create width, height

# Load existing image file on disk into memory
gd.openPng "test.png", (err, input_img) ->
  console.log "width: ", input_img.width
  console.log "height: ", input_img.width

# Render input over the top of output
input_img.copyResampled output_img, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH

# Write image buffer to disk
output_img.savePng "out.png", 0, (err) ->
  console.log "image saved!"

As usual, for the latest examples, review the easy-to-follow ./test/test.coffee.

Related

Something went wrong with that request. Please try again.