Skip to content

Latest commit

 

History

History
91 lines (70 loc) · 1.71 KB

cookbook.md

File metadata and controls

91 lines (70 loc) · 1.71 KB

Cookbook

Some example usage

Use LINK to import

]LINK.Create pnm /Users/ldbeth/Public/Projects/pnmaster/APL_code

Image formats

Prepare an image NetPBM format

PNG

pngtopnm input.png > out.ppm

The program automatically decides whether it outputs PPM or PGM, in case the PNG image only uses gray scale. The NetPBM programs always write output to standard ourput.

Use pgmtoppm to promote an PGM image to PPM, or in the APL,

(3,)image

readpnm

    inputpnm.readpnm 'input.pgm'

writepnm

    /,bit
1
    bit pnm.writepnm 'P4' 'output.pbm'  PBM file.
    /,grey
255
    grey pnm.writepnm 'P5' 'output.pgm'  PGM file.
    color
3
    /,color
255
    color pnm.writepnm 'P6' 'output.ppm'  PPM file.

Blue noise pattern and dither

Generate a blue noise pattern of specified radius for dithering:

      pnm.Image.Bluenoise.mkda 13
26 26
      pnm.Image.Bluenoise.MASK64  Precomputed pattern
64 64

Convert the PGM to PBM using dithering:

pbmpnm.Image.(Bluenoise.MASK64Dither.dither) pgm

Curvature filter

outpnm.(Pgm.quantizeImage.curva) in

Knuth's dot diffusion

outpnm.Image.(Bluenoise.MASK32Dither.diffuse) in

CIELAB Steganography

labpnm.Ppm.cielab pnm.readpnm 'b.ppm'
binpnm.readpnm 'o.pbm'  binary image to hide
pnm.Image.Stega.histo lab  Find the direction that occurs less
tpnm.Image.Stega.direc 95
outlab (t pnm.Image.Stega.gdb 3) bin
ppmpnm.Ppm.delab out
ppm pnm.writepnm 'P6' 'o.ppm'
decodepnm.Ppm.cielab pnm.readpnm 'o.ppm'
r95 pnm.Image.Stega.decode decode
r pnm.writepnm 'P4' 'dec95.pbm'