
Netpbm format - networked
https://en.wikipedia.org/wiki/Netpbm_format
======
sabalaba
I remember running across the NetPBM format when I was looking at some of the
images that are stored in jwz's folder on the CMU AI repository. There's
something very nice about storing a bitmap in pure text. (AWK image processing
comes to mind.)

[http://www.cs.cmu.edu/afs/cs/project/ai-
repository/ai/lang/l...](http://www.cs.cmu.edu/afs/cs/project/ai-
repository/ai/lang/lisp/code/impdep/explorer/)

~~~
dwc
Of course you could use awk or anything else, but for most tasks there are
already transforms in the netpbm tools that work well. In addition to being in
text format, the meta info always comes first, which facilitates streaming.
That in turn means that if you pipe together four transforms you'll use four
cores without even trying.

------
phorese
I've been using the PFM format
([http://netpbm.sourceforge.net/doc/pfm.html](http://netpbm.sourceforge.net/doc/pfm.html))
for a project recently.

It's the most obscure member of the Netpbm family. Almost no image viewer
understands it, and _no_ image editor can read or write it. Luckily there's
the incredible CImg ([http://www.cimg.eu/](http://www.cimg.eu/)) lib.

PFM is stored in left to right, _bottom to top_ order pixel. It has exactly
one or three channels. One pixel is four bytes. There's an obscure
"scale/endianness" parameter to tell you the byte order.

I love it, and I hate it.

~~~
techdragon
Which makes it impossible for me not to ask...

Why are you using it for the project? Is it for interoperability with some
other component? If so, what sort of thing is using such a format, I'm
intrigued.

~~~
phorese
Good question :)

I needed a quick way to hack the output of 2D float data (pixel annotations to
complement some image) into some legacy C without adding dependencies.

Thanks to CImg, I can read and display the PFM files in 10 lines of my own
C++. I thought about just writing a width/height-annotated binary blob
instead, but then realized that's really what PFM already is.

I have no idea if anything is really _using_ PFM. I certainly have not found
any "big" compatible programs.

------
detaro
featured in the 2008 underhanded C contest with some interesting tricks:
[http://www.underhanded-c.org/_page_id_17.html](http://www.underhanded-c.org/_page_id_17.html)

------
Zardoz84
Ja! I used PBM format to create bitmap fonts for some retro-computing fun.

[https://github.com/trillek-team/trillek-vcomputer-
module/blo...](https://github.com/trillek-team/trillek-vcomputer-
module/blob/develop/tools/pbm2font.cpp)

------
cygx
I recently played around with this and came up with my own variant:

[http://cygx.github.io/js-rgba/](http://cygx.github.io/js-rgba/)

 _Only tested in Firefox, no idea if it works in other browsers..._

~~~
i336_
Works fine in Chrome 46.0 from what I can see.

My image downloader extension even recognizes the results as images and puts
save buttons on them. :D

What would be really cool would be to open the source text into a <textarea>
so people could play with it, with an "auto-update" checkbox and everything.
:D

Also, atm to switch from the rendered result back to the source image, I have
to reload the page. Maybe the button could toggle, or the result and source
could be on the page simultaneously.

------
cjensen
Why are they called _Net_ pbm format when they were invented by Poskanzer
years before the NetPBM project was founded?

~~~
_wmd
Stuff usually gets "net" slapped on the front after some attempt has been made
to specify or regularize it, that way the documented/maintained version
doesn't share the name with any classic implementation, which helps to avoid
all kinds of ambiguity.

Not sure where this idiom came from, but seen it used a bunch of times

~~~
thristian
Nethack? NetBSD? Netatalk?

~~~
jaxb
netatalk is likely just a dir name, like netinet or netns.

------
jandrese
Yep, that sure is a primitive image format.

~~~
waynecochran
Yes, but very useful since its easy to parse and trivial to generate. You can
always pipe input/output through conversion utilities to your format of choice
(pgm, jpg, ...).

~~~
jacobolus
You know what’s even more trivial to parse and generate? Arrays of
uncompressed binary data.

~~~
ajross
No. Unstructured binary data in arbitrary formats if fundamentally impossible
to parse successfully. Oh, your parser works you say? It won't next project
after the format change again.

The pbm stuff is an attempt to specify the simplest possible format that can
be used robustly in practice.

~~~
jacobolus
It seemed like the parent posters in this thread were talking about the plain
text version of the format, which is IMO ridiculous for any non-toy use. My
response was half-sarcastic; tone doesn’t make it through the internet though
I guess.

The binary version is fine, though in general I’d recommend just using PNG,
TIF, JPEG, or whatever.

