Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 1.71 KB

tpl.readme.md

File metadata and controls

65 lines (43 loc) · 1.71 KB

About

{{pkg.description}}

Similar to the NetPBM formats, the Portable FloatMap image format is extremely simple, uncompressed and mainly interesting for development purposes & interchange (e.g. for use with Intel's Open Image Denoise CLI tools).

{{meta.status}}

{{repo.supportPackages}}

{{repo.relatedPackages}}

{{meta.blogPosts}}

Installation

{{pkg.install}}

{{pkg.size}}

Dependencies

{{pkg.deps}}

{{repo.examples}}

API

{{pkg.docs}}

The package only provides 2 functions:

import { intBuffer, RGB888 } from "@thi.ng/pixel";
import { asPFM }  from "@thi.ng/pixel-io-pfm";
import { writeFileSync } from "fs";

// create 2x2 image
const img = intBuffer(2, 2, RGB888);
// set pixel data (R,G,B,Y)
img.data.set([0xff0000, 0x00ff00, 0x0000ff, 0xffff00]);

// serialize image to PFM byte array and write to file
// (format conversion to FLOAT_RGB is done automatically & non-destructively)
writeFileSync("export/rgby.pfm", asPFM(img));