Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The Netpbm PAM documentation suggests that I will have a fairly seamless transition if I choose to start using PAM instead of PPM/PGM/PBM as an image format:

"PAM" is in fact a fourth format. But it is so general that you can represent the same information in a PAM image as you can in a PBM, PGM, or PPM image. And in fact a program that is designed to read PBM, PGM, or PPM and does so with a recent version of the Netpbm library, will read an equivalent PAM image just fine and the program will never know the difference.

[Updated: 09 October 2005 ]

Note: The above comment is also included in man pam on the systems that I am having trouble with.

However, when I run Netpbm utilities on Ubuntu (several versions including 12.10), it does not work as advertised:

$ pnminvert
pnminvert: bad magic number - not a ppm, pgm, or pbm file

I have verified that some other distributions, as well as from-source builds of netpbm-super-stable (also stable, advanced), do not have this problem.

It looks like from the packages page, that this package is being updated periodically, so I can't figure out why the Ubuntu versions wouldn't work.

I want to deploy tools based on this to an arbitrarily large number of machines, so build-from-source isn't appealing. Any ideas about how to make this work on Ubuntu?

share|improve this question
I have found that ImageMagick (e.g. convert,display) knows how to deal with simple PAM images. You can generate a PAM image with convert - pam:- <input_file >output_file – nobar Feb 19 '13 at 22:54
Maybe build-from source isn't such a bad idea -- just make it part of your deployment. – nobar Jun 22 '13 at 17:22
Here's something cool that you can't do with the stock version on Ubuntu -- combine separate monochrome images into a CMYK tiff: pamstack -tupletype CMYK c.pnm m.pnm y.pnm k.pnm |pamtotiff >cmyk.tif. pamtotiff is not included on Ubuntu and, surprisingly, ImageMagick, convert doesn't get the job done either. – nobar Sep 26 '14 at 23:27
Update to previous comment: convert pam:- tif:- seems to work fine for this on Ubuntu 13.10 -- I'll have to retest on 14.04 LTS... – nobar Sep 30 '14 at 17:23
Yes, I think ImageMagick convert works (on 13.10 and 14.04). I may have just gotten the command-line wrong the first time that I tried. – nobar Nov 18 '14 at 0:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.