Hi Terry, > > wget -q -O lenna.png \ > > > > https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png > > > > w=128 h=128 # Desired size. > > pngtopnm lenna.png | > > pamscale -xyfit $w $h | > > pnmpad -w $w -h $h | > > pnmremap -mapfile=<(pamseq 1 15) | > > pnmtopng >lenna-grey.png ... > Anyway, I thought I would give your bash code a try. I found and fixed an > error; pamscale doesn't exist, but pnmscale does but I still can't make it > work. When execution reaches the penultimate line I get the error: > > ./scale: line 5: pamseq: command not found
You're falling foul of a Debian bug from 2008. https://bugs.launchpad.net/ubuntu/+source/netpbm-free/+bug/270479 For some reason, Debian and Ubuntu's maintainer for the netpbm package, Andreas Barth, sticks to an ancient release of the source code. As that bug report says, Fedora doesn't suffer the same problem. One of the people commenting in that bug report has made a PPA available with a more modern netpbm package. https://launchpad.net/~darkdragon-001/+archive/ubuntu/ppa It's been a long time since I've tried PPAs on Ubuntu but that might allow you to install a half-decent version. If so, I'd revert your change away from pamscale(1) too in case there's some subtle difference with pnmscale. > I assume that 'pamseq 1 15' is telling pnmremap to change the image > colormap to 16 levels. I would have expected the numbers to be 0 & 15 > or 1 & 16. Any reason why 1 & 15 are used? https://manned.org/pamseq.1 describes its options and behavior. It's generating an image which is 16x1 pixels, each pixel has just one channel, RGB has three channels by comparison, which is four bits. The pixels ascend through all possible values. 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 It's providing the palette of allowable colours from which pnmremap may choose when converting its input to output. If you still have trouble getting hold of netpbm then I can probably provide the equivalent pipeline as a gmic(1) command. :-) -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2020-12-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk