GNOME Bugzilla – Bug 167578
Support for saving PBM format
Last modified: 2008-01-15 12:47:59 UTC
Gimp can save in PPM format but not PBM. PBM is 'portable bitmap' and for black and white, one-bit-per-pixel images. Some programs expect this format. At least, I don't see PBM on the list of formats in the Save As box and it doesn't recognize the .pbm extension. Adding it would be a useful enhancement.
GIMP reads PBM but it doesn't save it. Mainly because it doesn't have the concept of 1bit per pixel images. There are so many tools available to convert to the PBM format, I don't think it's worth adding it to GIMP. But of course if someone wants to send a patch, then why not.
Out of interest: could you suggest a tool which converts to PBM format?
For example ppmtopgm combined with pgmtopbm. IMHO it wouldn't hurt to have this, should be a reasonably easy enhancement to pnm.c.
*** Bug 316052 has been marked as a duplicate of this bug. ***
also "unpaper" is a program worth looking at
Created attachment 65496 [details] [review] Adds PBM writing to pnm.c
The patch looks very clean and should be applied soon before it starts to bit-rot.
I tried the patch and it saves raw PBM files just fine. Loading an ascii PBM file saved with the patch fails with: PNM: Premature end of file.
The load function is looking for another byte. I'll fix it in the next few days.
Martin, any news? I'd really like to get this into 2.4
Created attachment 66350 [details] [review] PBM writing plus ascii reading fix Also: man pbm says "Programs that read this format should be as lenient as possible, accepting anything that looks remotely like a bitmap" so reading truncated ascii files now gives warning rather than error.
The path doesn't apply: patch: **** malformed patch at line 140: @@ -716,6 +755,64 @@ pnm_load_rawpbm (PNMScanner *scan, Strange, sine it looks absolutely ok. Can you re-diff please?
Created attachment 66380 [details] [review] Fresh diff I must have mangled the last one somehow. Only three line changes in addition to my original patch.
Thanks :) Fixed in CVS: 2006-05-28 Michael Natterer <mitch@gimp.org> * plug-ins/common/pnm.c: applied patch from Martin Collins which adds PBM (bitmap) support. Fixes bug #167578. Did some additional cleanups and sprinkled some gimp_progress_update(1.0).