Subscribe Bookmark



Jun 17, 2013

PNM Import

Years ago I worked with some file formats that were collectively known as PNM. They included PBM - Portable Bit Map, PGM - Portable Gray Map and PPM - Portable Pixel map, which is RGB pixels. Although those formats don't seem very popular these days, I recently came across a JMP customer who is still using them and they wanted to read the files into JMP. JMP currently supports image formats like PNG and JPG but not the PNM formats. So I wrote a PNM Importer in JSL. This script will read either an ascii or binary version of a PBM, PGM or PPM image into JMP. The ascii reader is a little slow (ok its a lot slow for larger PPM images) but it did seem to work on the examples I tried. You can find it on the File Exchange, under JSL Scripts, as PNMImport​.

I made it easy by specifying the name of the PNM image in the script. So be sure to replace that with your file name. Then run the script. I did it this way so you could patch this script into any other script you are using, such as the Image Analyzer.

So if you have any PNM images and you want to read them into JMP, give this script a try. If you find it useful let me know. And if you find it doesn't work on your files, let me know that too. If you can send me an example that would be great. I'll use it to diagnose the issue and fix it.

Article Tags