diff --git a/pngjs2/pngjs2-tests.ts b/pngjs2/pngjs2-tests.ts
new file mode 100644
index 000000000..ae2d73e7b
--- /dev/null
+++ b/pngjs2/pngjs2-tests.ts
@@ -0,0 +1,26 @@
+///
+
+import * as fs from "fs";
+import { PNG } from "pngjs2";
+
+let png = new PNG({ filterType: 4 });
+
+fs.createReadStream("in.png")
+ .pipe(png)
+ .on("parsed", () => {
+ for (let y = 0; y < png.height; y++) {
+ for (let x = 0; x < png.width; x++) {
+ let idx = (png.width * y + x) << 2;
+
+ // invert color
+ png.data[idx] = 255 - png.data[idx];
+ png.data[idx+1] = 255 - png.data[idx+1];
+ png.data[idx+2] = 255 - png.data[idx+2];
+
+ // and reduce opacity
+ png.data[idx+3] = png.data[idx+3] >> 1;
+ }
+ }
+
+ png.pack().pipe(fs.createWriteStream('out.png'));
+ });
diff --git a/pngjs2/pngjs2.d.ts b/pngjs2/pngjs2.d.ts
new file mode 100644
index 000000000..e44dbfdd6
--- /dev/null
+++ b/pngjs2/pngjs2.d.ts
@@ -0,0 +1,64 @@
+// Type definitions for pngjs2 2.0.0
+// Project: https://www.npmjs.com/package/pngjs2
+// Definitions by: Elisée Maurer
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "pngjs2" {
+ import fs = require("fs");
+ import events = require("events");
+ import stream = require("stream");
+
+ interface PNGOptions {
+ width?: number;
+ height?: number;
+ checkCRC?: boolean;
+ deflateChunkSize?: number;
+ deflateLevel?: number;
+ deflateStrategy?: number;
+ deflateFactory?: any;
+ filterType?: number|number[];
+ colorType?: number;
+ inputHasAlpha?: boolean;
+ }
+
+ interface PNGMetadata {
+ width: number;
+ height: number;
+ palette: boolean;
+ color: boolean;
+ alpha: boolean;
+ interlace: boolean;
+ }
+
+ export class PNG extends stream.Writable {
+ constructor(options?: PNGOptions);
+
+ width: number;
+ height: number;
+ data: Buffer;
+ gamma: number;
+
+ on(event: string, callback: Function): PNG;
+ on(event: "metadata", callback: (metadata: PNGMetadata) => void): PNG;
+ on(event: "parsed", callback: (data: Buffer) => void): PNG;
+ on(event: "error", callback: (err: Error) => void): PNG;
+
+ parse(data: string|Buffer, callback?: (err: Error, data: Buffer) => void): PNG;
+ pack(): PNG;
+ pipe(destination: fs.WriteStream): PNG;
+
+ static bitblt(src: PNG, dst: PNG, srcX: number, srcY: number,
+ width: number, height: number, deltaX: number, deltaY: number): void;
+
+ bitblt(dst: PNG, srcX: number, srcY: number,
+ width: number, height: number, deltaX: number, deltaY: number): PNG;
+ }
+
+ export namespace PNG {
+ namespace sync {
+ function read(buffer: string|Buffer, options?: PNGOptions): PNG;
+ }
+ }
+}