Hi Terry,

Whilst all this clicking means you're learning Gimp, and it could
instead be coded in Python using the Python Imaging Library we keep
referring to, there's also Netpbm from the shell.

    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

Lenna image is square to start with, but the above will pad an image up
with black to make it square, centring as it goes.

Your existing code will happily take lenna-grey.png; it doesn't insist
on a Windows BMP.

    $ file lenna-grey.png
    lenna-grey.png: PNG image data, 128 x 128, 4-bit grayscale, non-interlaced

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2020-09-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

Reply via email to