After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 167578 - Support for saving PBM format
Support for saving PBM format
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other All
: Normal enhancement
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
: 316052 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-02-16 10:28 UTC by Ed Avis
Modified: 2008-01-15 12:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds PBM writing to pnm.c (10.95 KB, patch)
2006-05-15 12:38 UTC, Martin Collins
needs-work Details | Review
PBM writing plus ascii reading fix (12.32 KB, patch)
2006-05-27 22:00 UTC, Martin Collins
none Details | Review
Fresh diff (12.07 KB, patch)
2006-05-28 19:36 UTC, Martin Collins
committed Details | Review

Description Ed Avis 2005-02-16 10:28:55 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.
Comment 1 Sven Neumann 2005-02-16 11:30:22 UTC
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.
Comment 2 Ed Avis 2005-02-16 15:07:27 UTC
Out of interest: could you suggest a tool which converts to PBM format?
Comment 3 Simon Budig 2005-02-16 15:24:49 UTC
For example ppmtopgm combined with pgmtopbm.

IMHO it wouldn't hurt to have this, should be a reasonably easy enhancement to
pnm.c.
Comment 4 Sven Neumann 2005-09-12 09:22:54 UTC
*** Bug 316052 has been marked as a duplicate of this bug. ***
Comment 5 Lode Leroy 2005-09-13 06:53:58 UTC
also "unpaper" is a program worth looking at
Comment 6 Martin Collins 2006-05-15 12:38:02 UTC
Created attachment 65496 [details] [review]
Adds PBM writing to pnm.c
Comment 7 Michael Natterer 2006-05-15 13:19:31 UTC
The patch looks very clean and should be applied soon before
it starts to bit-rot.
Comment 8 Michael Natterer 2006-05-15 20:58:44 UTC
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.
Comment 9 Martin Collins 2006-05-17 15:55:33 UTC
The load function is looking for another byte. I'll fix it in the next few days.
Comment 10 Michael Natterer 2006-05-27 17:09:50 UTC
Martin, any news? I'd really like to get this into 2.4
Comment 11 Martin Collins 2006-05-27 22:00:27 UTC
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.
Comment 12 Michael Natterer 2006-05-28 14:24:57 UTC
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?
Comment 13 Martin Collins 2006-05-28 19:36:53 UTC
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.
Comment 14 Michael Natterer 2006-05-28 21:30:52 UTC
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).