JavaScript library for parsing IFF PBM files. This is the format used by the PC version of Deluxe Paint II and is different from the Amiga version.
 
 
 
Go to file
Michael Smith bb96f405b7 Fix crash in viewer example code when image does not contain a thumbnail 2023-06-04 22:08:40 +02:00
assets Initial commit 2023-05-12 10:50:34 +02:00
docs Initial commit 2023-05-12 10:50:34 +02:00
src Slowly work towards more pure functions 2023-05-31 22:20:40 +02:00
tests Remove unnecessary wrapping of functionality in a class 2023-05-31 20:49:44 +02:00
.eslintrc.cjs Switch to prettier default config of using double quotes 2023-05-30 10:42:26 +02:00
.gitignore Initial commit 2023-05-12 10:50:34 +02:00
LICENSE Initial commit 2023-05-12 10:50:34 +02:00
README.md Remove unnecessary wrapping of functionality in a class 2023-05-31 20:49:44 +02:00
index.html Add palette viewer and color cycling to proof of concept viewer 2023-05-14 22:38:12 +02:00
main.js Fix crash in viewer example code when image does not contain a thumbnail 2023-06-04 22:08:40 +02:00
package-lock.json Add and configure eslint 2023-05-27 15:31:55 +02:00
package.json Add and configure eslint 2023-05-27 15:31:55 +02:00
style.css Add palette viewer and color cycling to proof of concept viewer 2023-05-14 22:38:12 +02:00

README.md

pbm-js

JavaScript library for parsing IFF PBM files.

This is the format used by the PC version of Deluxe Paint II and is different from the Amiga version.

Features

  • Written using ES6 modules, runs out of the box in modern browsers.
  • 100% plain JavaScript. No dependencies.
  • Compatible with all Mark J. Ferrari's artwork I could find.

Try it out at https://michaelshmitty.github.io/pbm-js/. You will need to supply your own IFF PBM files. All processing is done in your browser, no data is sent to any server.

Usage

In the browser

Also see index.html and main.js for a more elaborate example that renders the image and palette data to an html5 canvas and supports color cycling.

import parsePBM from "./src/pbm.js";

fetch("/assets/TEST.LBM")
  .then((response) => {
    return response.arrayBuffer();
  })
  .then((buffer) => {
    const image = parsePBM(buffer);
    console.log(image);
  });

In Node.js

import * as fs from "fs";

import parsePBM from "./src/pbm.js";

const data = fs.readFileSync("./tests/fixtures/VALID.LBM");
const image = parsePBM(data.buffer);
console.log(image);

Testing

# Install test framework and dependencies (requires Node.js)
npm install
# Run the tests
npm run test

References

  • libiff: Portable, extensible parser for the Interchange File Format (IFF). Well documented and very detailed C implementation of the IFF file format by Sander van der Burg.
  • DPaint-js: Web based image editor, modeled after the legendary Deluxe Paint with a focus on retro Amiga file formats: read and write Amiga icon files and IFF ILBM images.

Contributing

If you find an IFF PBM file that cannot be parsed by this library, please open an issue or send it to me if licensing / copyright permits you to share it.

Suggestions, bug reports and pull requests welcome.