Whatever is going on, it can't be exactly what you wrote:
exec wxdtopnm < file.xwd | pamdepth 6 | ppmtogif > file.gif
When I try doing the equivalent (for our purposes; I don't have any XWD images around):
exec pngtopnm sample.png | pamdepth 6 | ppmtogif >foo.gif
I don't get that error you report. Instead, I get:
pamtogif: computing colormap... pamtogif: 121 colors found
These are trivial errors caused by the interaction of the fact that pamdepth
is chatty on its standard error channel (some programs just are) and the fact that Tcl's exec
turns messages on standard error into error messages by default. That's often the right thing, but we don't want it here. But there's a trivial workaround:
exec pngtopnm sample.png | pamdepth 6 2>/dev/null | ppmtogif >foo.gif
This redirects standard error from pamdepth
only to the system bit-bucket, leaving the rest of the pipeline to work as expected.
I can't say for sure if this will work for you (I really don't know where that 6
error is coming from!) but it does for me when I try.