Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ppm

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ppm

A simple streaming ascii PPM image parser/writer

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-1.5%
Maintainers
1
Weekly downloads
 
Created
Source

ppm

This code implements a streaming parser/serializer for ascii PPM formatted images in JavaScript. The PPM file format is very simple and human readable, so it can be useful when debugging graphics applications. The downside though is that PPM is not a very efficient format, and so it is not really suitable for long term archival or transmission of images. For those applications, you should use a standard network image format like PNG or JPEG, depending on your requirements.

Usage/Installation

To install, first you do:

npm install ppm

And here is how you can use it to write/read back an image:

var ppm = require("ppm");

var image = [
  [[255, 0, 0], [255, 0, 0], [255, 0, 0]],
  [[0, 255, 0], [0, 255, 0], [0, 255, 0]],
  [[0, 0, 255], [0, 0, 255], [0, 0, 255]]
];

ppm.parse(ppm.serialize(image), function(err, img) {
  console.log(err, img);
});

The API is streaming, and should be compatible with all the stand node.js features from fs/net/etc..

ppm.parse(stream, cb(err, result))

Parses an ASCII ppm file from the stream. When finished, calls result with the error/result of parsing the file.

ppm.serialize(image)

Converts an image into an ASCII ppm stream

Credits

(c) 2013 Mikola Lysenko. BSD

Keywords

FAQs

Package last updated on 13 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc