PAM is a close relative of PNM (portable any map) supported by FFmpeg (example). Like the binary PNM formats (P4..P6, the ASCII versions are P1..P3) it consists of a small text header followed by a binary bitmap. Arguably parsing a PAM header (P7 format) is simpler than parsing a PNM header.
In theory PAM can replace the PNM formats, and it "officially" supports 16 bits (MAXVAL 65535) instead of only 8 bits (MAXVAL 255) for gray maps and pix maps. Of course folks use 16 bits also for P2/P5 (PGM) and P3/P6 (PPM), so that's not very interesting. The rather odd P1/P4 format (PBM) with one bit per pixel (FFmpeg pixel_fmt monob, 1 = black) ends up as a MAXVAL=1 gray map in PAM (pixel_fmt monow, 1 = white, one byte per pixel).
The interesting PAM feature is RGBA (DEPTH=4) with an alpha channel, and DEPTH=2 for a gray map with transparency. I use FFmpeg to convert PNG to PAM, decode this in a script, "do stuff" (e.g., extract tiles from a grid in a Freeciv tileset), and eventually I convert the output PAM(s) with FFmpeg back to PNG(s). If XnView could display PAM I could skip some PNG -> PAM -> PNG -> PAM -> PNG steps.
PAM (portable arbitrary map)
Moderators: XnTriq, helmut, xnview
-
- Posts: 127
- Joined: Thu Feb 10, 2011 1:52 pm
- Location: Hamburg
-
- Author of XnView
- Posts: 44589
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
- Posts: 127
- Joined: Thu Feb 10, 2011 1:52 pm
- Location: Hamburg
Re: PAM (portable arbitrary map)
I saved your forum avatar as XnView.png, and converted it to PAM with...xnview wrote:do you have some samples?
Code: Select all
ffmpeg -hide_banner -i xnview.png -c:v pam -pix_fmt rgba xnview.pam
Code: Select all
P7
WIDTH 100
HEIGHT 100
DEPTH 4
MAXVAL 255
TUPLTYPE RGB_ALPHA
ENDHDR
You do not have the required permissions to view the files attached to this post.
-
- Posts: 127
- Joined: Thu Feb 10, 2011 1:52 pm
- Location: Hamburg
Re: PAM (portable arbitrary map)
The infamous SignedShortLosslessBug.jpg published by the Grassroots DICOM project, MediaWiki and XnView cannot display it, but FFmpeg works:xnview wrote:do you have some samples?
Code: Select all
ffmpeg -i SignedShortLosslessBug.jpg SignedShortLosslessBug.pam
Code: Select all
P7
WIDTH 512
HEIGHT 512
DEPTH 1
MAXVAL 65535
TUPLTYPE GRAYSCALE
ENDHDR
You do not have the required permissions to view the files attached to this post.